use of com.amazonaws.services.xray.model.GetSamplingRulesRequest in project aws-xray-sdk-java by aws.
the class TracingHandlerTest method testShouldNotThrowContextMissingOnXRaySampling.
@Test
void testShouldNotThrowContextMissingOnXRaySampling() {
com.amazonaws.services.xray.AWSXRay xray = AWSXRayClientBuilder.standard().withRequestHandlers(new TracingHandler()).withRegion(Regions.US_EAST_1).withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("fake", "fake"))).build();
mockHttpClient(xray, null);
xray.getSamplingRules(new GetSamplingRulesRequest());
xray.getSamplingTargets(new GetSamplingTargetsRequest());
}
use of com.amazonaws.services.xray.model.GetSamplingRulesRequest 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("{}")));
}
use of com.amazonaws.services.xray.model.GetSamplingRulesRequest 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);
}
use of com.amazonaws.services.xray.model.GetSamplingRulesRequest in project aws-xray-sdk-java by aws.
the class TracingHandlerTest method testShouldNotTraceXRaySamplingOperations.
@Test
void testShouldNotTraceXRaySamplingOperations() {
com.amazonaws.services.xray.AWSXRay xray = AWSXRayClientBuilder.standard().withRequestHandlers(new TracingHandler()).withRegion(Regions.US_EAST_1).withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("fake", "fake"))).build();
mockHttpClient(xray, null);
Segment segment = AWSXRay.beginSegment("test");
xray.getSamplingRules(new GetSamplingRulesRequest());
Assertions.assertEquals(0, segment.getSubsegments().size());
xray.getSamplingTargets(new GetSamplingTargetsRequest());
Assertions.assertEquals(0, segment.getSubsegments().size());
}
Aggregations