Search in sources :

Example 1 with GetSamplingRulesResult

use of com.amazonaws.services.xray.model.GetSamplingRulesResult in project aws-xray-sdk-java by aws.

the class UnsignedXrayClientTest method getSamplingRules.

@Test
public void getSamplingRules() throws Exception {
    stubFor(any(anyUrl()).willReturn(aResponse().withStatus(200).withBody(SAMPLING_RULES)));
    GetSamplingRulesResult result = client.getSamplingRules(new GetSamplingRulesRequest());
    GetSamplingRulesResult expected = OBJECT_MAPPER.readValue(SAMPLING_RULES, GetSamplingRulesResult.class);
    assertThat(expected).isEqualTo(result);
    verify(postRequestedFor(urlEqualTo("/GetSamplingRules")).withHeader("Content-Type", equalTo("application/json")).withRequestBody(equalToJson("{}")));
}
Also used : GetSamplingRulesResult(com.amazonaws.services.xray.model.GetSamplingRulesResult) GetSamplingRulesRequest(com.amazonaws.services.xray.model.GetSamplingRulesRequest) Test(org.junit.Test)

Example 2 with GetSamplingRulesResult

use of com.amazonaws.services.xray.model.GetSamplingRulesResult in project aws-xray-sdk-java by aws.

the class RulePoller method pollRule.

private void pollRule() {
    Instant now = clock.instant();
    logger.info("Polling sampling rules.");
    GetSamplingRulesRequest req = new GetSamplingRulesRequest();
    GetSamplingRulesResult records = client.getSamplingRules(req);
    List<SamplingRule> rules = records.getSamplingRuleRecords().stream().map(SamplingRuleRecord::getSamplingRule).filter(CentralizedRule::isValid).collect(Collectors.toList());
    manifest.putRules(rules, now);
}
Also used : SamplingRuleRecord(com.amazonaws.services.xray.model.SamplingRuleRecord) GetSamplingRulesResult(com.amazonaws.services.xray.model.GetSamplingRulesResult) Instant(java.time.Instant) GetSamplingRulesRequest(com.amazonaws.services.xray.model.GetSamplingRulesRequest) SamplingRule(com.amazonaws.services.xray.model.SamplingRule)

Aggregations

GetSamplingRulesRequest (com.amazonaws.services.xray.model.GetSamplingRulesRequest)2 GetSamplingRulesResult (com.amazonaws.services.xray.model.GetSamplingRulesResult)2 SamplingRule (com.amazonaws.services.xray.model.SamplingRule)1 SamplingRuleRecord (com.amazonaws.services.xray.model.SamplingRuleRecord)1 Instant (java.time.Instant)1 Test (org.junit.Test)1