com.amazonaws.xray.AWSXRayRecorderBuilder Java Examples
The following examples show how to use
com.amazonaws.xray.AWSXRayRecorderBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TracingHandlerTest.java From aws-xray-sdk-java with Apache License 2.0 | 6 votes |
@Test public void testRaceConditionOnRecorderInitialization() { AWSXRay.setGlobalRecorder(null); // TracingHandler will not have the initialized recorder AWSLambda lambda = AWSLambdaClientBuilder .standard() .withRequestHandlers(new TracingHandler()) .withRegion(Regions.US_EAST_1) .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("fake", "fake"))) .build(); mockHttpClient(lambda, "null"); // Now init the global recorder AWSXRayRecorder recorder = AWSXRayRecorderBuilder.defaultRecorder(); recorder.setContextMissingStrategy(new LogErrorContextMissingStrategy()); AWSXRay.setGlobalRecorder(recorder); // Test logic InvokeRequest request = new InvokeRequest(); request.setFunctionName("testFunctionName"); lambda.invoke(request); }
Example #2
Source File: CustomSegmentContextTest.java From aws-xray-sdk-java with Apache License 2.0 | 6 votes |
@Before 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()); 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(); }
Example #3
Source File: ApplicationModule.java From realworld-serverless-application with Apache License 2.0 | 5 votes |
@Override protected void configure() { // Disable AWS x-ray in integration tests. // See doc: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java-configuration.html#xray-sdk-java-configuration-sysprops AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard().withContextMissingStrategy(new LogErrorContextMissingStrategy()).build()); bind(ScenarioScope.class).toInstance(new SequentialScenarioScope()); }
Example #4
Source File: ApplicationModule.java From realworld-serverless-application with Apache License 2.0 | 5 votes |
@Override protected void configure() { // Disable AWS x-ray in integration tests. // See doc: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java-configuration.html#xray-sdk-java-configuration-sysprops AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard().withContextMissingStrategy(new LogErrorContextMissingStrategy()).build()); bind(ScenarioScope.class).toInstance(new SequentialScenarioScope()); }
Example #5
Source File: HttpClientBuilderTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before public void setupAWSXRay() { // Prevent accidental publish to Daemon 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).build()); AWSXRay.clearTraceEntity(); }
Example #6
Source File: TracedResponseHandlerTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before 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).build()); AWSXRay.clearTraceEntity(); }
Example #7
Source File: TracingInterceptorTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before public void setup() { Emitter blankEmitter = Mockito.mock(Emitter.class); Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.anyObject()); AWSXRay.setGlobalRecorder( AWSXRayRecorderBuilder.standard() .withEmitter(blankEmitter) .build() ); AWSXRay.clearTraceEntity(); AWSXRay.beginSegment("test"); }
Example #8
Source File: Log4JSegmentListenerTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before public void setupAWSXRay() { Emitter blankEmitter = Mockito.mock(Emitter.class); Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.any()); Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.any()); Log4JSegmentListener segmentListener = new Log4JSegmentListener(); AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard() .withEmitter(blankEmitter) .withSegmentListener(segmentListener) .build()); AWSXRay.clearTraceEntity(); ThreadContext.clearAll(); }
Example #9
Source File: TracingHandlerTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before 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).build()); AWSXRay.clearTraceEntity(); }
Example #10
Source File: SLF4JSegmentListenerTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before public void setupAWSXRay() { Emitter blankEmitter = Mockito.mock(Emitter.class); Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.any()); Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.any()); SLF4JSegmentListener segmentListener = new SLF4JSegmentListener(); AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard().withEmitter(blankEmitter).withSegmentListener(segmentListener).build()); AWSXRay.clearTraceEntity(); MDC.clear(); }
Example #11
Source File: AWSXRayServletFilterTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
private AWSXRayRecorder getMockRecorder() { Emitter blankEmitter = Mockito.mock(Emitter.class); LocalizedSamplingStrategy defaultSamplingStrategy = new LocalizedSamplingStrategy(); Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.anyObject()); Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.anyObject()); return AWSXRayRecorderBuilder.standard().withEmitter(blankEmitter).withSamplingStrategy(defaultSamplingStrategy).build(); }
Example #12
Source File: DefaultStreamingStrategyTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before public void setupAWSXRay() { Emitter blankEmitter = Mockito.mock(Emitter.class); LocalizedSamplingStrategy defaultSamplingStrategy = new LocalizedSamplingStrategy(); Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.anyObject()); Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.anyObject()); AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard() .withEmitter(blankEmitter) .withSamplingStrategy(defaultSamplingStrategy) .build()); AWSXRay.clearTraceEntity(); }
Example #13
Source File: SegmentListenerTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before public void setupAWSXRay() { Emitter blankEmitter = Mockito.mock(Emitter.class); Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.any()); Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.any()); CustomSegmentListener segmentListener = new CustomSegmentListener(); AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard() .withEmitter(blankEmitter) .withSegmentListener(segmentListener) .build()); AWSXRay.clearTraceEntity(); }
Example #14
Source File: LambdaSegmentContextTest.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
@Before 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(); }
Example #15
Source File: InvokeTest.java From aws-doc-sdk-examples with Apache License 2.0 | 4 votes |
public InvokeTest() { AWSXRayRecorderBuilder builder = AWSXRayRecorderBuilder.standard(); builder.withSamplingStrategy(new NoSamplingStrategy()); AWSXRay.setGlobalRecorder(builder.build()); }
Example #16
Source File: EntitySerializerBenchmark.java From aws-xray-sdk-java with Apache License 2.0 | 4 votes |
@Setup(Level.Trial) public void setupOnce() throws SocketException { recorder = AWSXRayRecorderBuilder.defaultRecorder(); }
Example #17
Source File: EntitySerializerBenchmark.java From aws-xray-sdk-java with Apache License 2.0 | 4 votes |
@Setup(Level.Trial) public void setupOnce() throws SocketException { recorder = AWSXRayRecorderBuilder.defaultRecorder(); }
Example #18
Source File: EntityBenchmark.java From aws-xray-sdk-java with Apache License 2.0 | 4 votes |
@Setup(Level.Trial) public void setupOnce() throws SocketException { recorder = AWSXRayRecorderBuilder.defaultRecorder(); theException = new Exception("Test Exception"); }
Example #19
Source File: AWSXRayServletContext.java From deployment-examples with MIT License | 4 votes |
public void contextInitialized(ServletContextEvent servletContextEvent) { // Initialize AWS XRay Recorder before any filters or servlets are created AWSXRayRecorderBuilder builder = AWSXRayRecorderBuilder.standard().withPlugin(new ElasticBeanstalkPlugin()); AWSXRay.setGlobalRecorder(builder.build()); }