Java Code Examples for com.amazonaws.xray.AWSXRayRecorderBuilder#defaultRecorder()

The following examples show how to use com.amazonaws.xray.AWSXRayRecorderBuilder#defaultRecorder() . 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 vote down vote up
@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: EntityBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void setupOnce() throws SocketException {
    recorder = AWSXRayRecorderBuilder.defaultRecorder();
    theException = new Exception("Test Exception");
}
 
Example 3
Source File: EntitySerializerBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void setupOnce() throws SocketException {
    recorder = AWSXRayRecorderBuilder.defaultRecorder();
}
 
Example 4
Source File: EntitySerializerBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void setupOnce() throws SocketException {
    recorder = AWSXRayRecorderBuilder.defaultRecorder();
}