Search in sources :

Example 6 with LocalizedSamplingStrategy

use of com.amazonaws.xray.strategy.sampling.LocalizedSamplingStrategy in project aws-xray-sdk-java by aws.

the class CustomSegmentContextTest method setupAWSXRay.

@BeforeEach
void setupAWSXRay() {
    Emitter blankEmitter = Mockito.mock(Emitter.class);
    Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.anyObject());
    Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.anyObject());
    LocalizedSamplingStrategy defaultSamplingStrategy = new LocalizedSamplingStrategy();
    SegmentContextResolverChain chain = new SegmentContextResolverChain();
    chain.addResolver(new GlobalMapSegmentContextResolver());
    AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard().withEmitter(blankEmitter).withSegmentContextResolverChain(chain).withSamplingStrategy(defaultSamplingStrategy).build());
    AWSXRay.clearTraceEntity();
}
Also used : Emitter(com.amazonaws.xray.emitters.Emitter) LocalizedSamplingStrategy(com.amazonaws.xray.strategy.sampling.LocalizedSamplingStrategy) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with LocalizedSamplingStrategy

use of com.amazonaws.xray.strategy.sampling.LocalizedSamplingStrategy in project aws-xray-sdk-java by aws.

the class LambdaSegmentContextTest method setupAWSXRay.

@BeforeEach
public void setupAWSXRay() {
    Emitter blankEmitter = Mockito.mock(Emitter.class);
    Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.anyObject());
    Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.anyObject());
    AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard().withEmitter(blankEmitter).withSamplingStrategy(new LocalizedSamplingStrategy()).build());
    AWSXRay.clearTraceEntity();
}
Also used : Emitter(com.amazonaws.xray.emitters.Emitter) LocalizedSamplingStrategy(com.amazonaws.xray.strategy.sampling.LocalizedSamplingStrategy) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Emitter (com.amazonaws.xray.emitters.Emitter)7 LocalizedSamplingStrategy (com.amazonaws.xray.strategy.sampling.LocalizedSamplingStrategy)7 Before (org.junit.Before)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3