public AWSXRayRecorder()

in aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/AWSXRayRecorder.java [140:187]


    public AWSXRayRecorder() {
        samplingStrategy = new DefaultSamplingStrategy();
        streamingStrategy = new DefaultStreamingStrategy();
        prioritizationStrategy = new DefaultPrioritizationStrategy();
        throwableSerializationStrategy = new DefaultThrowableSerializationStrategy();
        contextMissingStrategy = new DefaultContextMissingStrategy();
        idGenerator = new SecureIdGenerator();

        logReferences = new HashSet<>();

        Optional<ContextMissingStrategy> environmentContextMissingStrategy =
            AWSXRayRecorderBuilder.contextMissingStrategyFromEnvironmentVariable();
        Optional<ContextMissingStrategy> systemContextMissingStrategy =
            AWSXRayRecorderBuilder.contextMissingStrategyFromSystemProperty();
        if (environmentContextMissingStrategy.isPresent()) {
            logger.info("Overriding contextMissingStrategy. Environment variable "
                        + ContextMissingStrategy.CONTEXT_MISSING_STRATEGY_ENVIRONMENT_VARIABLE_OVERRIDE_KEY + " has value: \""
                    + System.getenv(ContextMissingStrategy.CONTEXT_MISSING_STRATEGY_ENVIRONMENT_VARIABLE_OVERRIDE_KEY) + "\".");
            contextMissingStrategy = environmentContextMissingStrategy.get();
        } else if (systemContextMissingStrategy.isPresent()) {
            logger.info("Overriding contextMissingStrategy. System property "
                        + ContextMissingStrategy.CONTEXT_MISSING_STRATEGY_SYSTEM_PROPERTY_OVERRIDE_KEY + " has value: \""
                    + System.getProperty(ContextMissingStrategy.CONTEXT_MISSING_STRATEGY_SYSTEM_PROPERTY_OVERRIDE_KEY) + "\".");
            contextMissingStrategy = systemContextMissingStrategy.get();
        }

        segmentContextResolverChain = new SegmentContextResolverChain();
        LambdaSegmentContextResolver lambdaSegmentContextResolver = new LambdaSegmentContextResolver();
        if (lambdaSegmentContextResolver.resolve() != null) {
            segmentContextResolverChain.addResolver(lambdaSegmentContextResolver);
        } else {
            segmentContextResolverChain.addResolver(new ThreadLocalSegmentContextResolver());
        }
        
        segmentListeners = new ArrayList<>();

        awsRuntimeContext = new ConcurrentHashMap<>();
        awsRuntimeContext.put("xray", SDK_VERSION_INFORMATION);

        serviceRuntimeContext = new ConcurrentHashMap<>();
        serviceRuntimeContext.putAll(RUNTIME_INFORMATION);

        try {
            emitter = Emitter.create();
        } catch (IOException e) {
            throw new RuntimeException("Unable to instantiate AWSXRayRecorder: ", e);
        }
    }