public AWSXRayRecorder() { samplingStrategy = new DefaultSamplingStrategy(); streamingStrategy = new DefaultStreamingStrategy(); prioritizationStrategy = new DefaultPrioritizationStrategy(); throwableSerializationStrategy = new DefaultThrowableSerializationStrategy(); contextMissingStrategy = new DefaultContextMissingStrategy(); 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(); segmentContextResolverChain.addResolver(new LambdaSegmentContextResolver()); segmentContextResolverChain.addResolver(new ThreadLocalSegmentContextResolver()); awsRuntimeContext = new ConcurrentHashMap<>(); awsRuntimeContext.put("xray", SDK_VERSION_INFORMATION); serviceRuntimeContext = new ConcurrentHashMap<>(); serviceRuntimeContext.putAll(RUNTIME_INFORMATION); try { emitter = new DefaultEmitter(); } catch (SocketException e) { throw new RuntimeException("Unable to instantiate AWSXRayRecorder: ", e); } }
public AWSXRayRecorder() { samplingStrategy = new DefaultSamplingStrategy(); streamingStrategy = new DefaultStreamingStrategy(); prioritizationStrategy = new DefaultPrioritizationStrategy(); throwableSerializationStrategy = new DefaultThrowableSerializationStrategy(); contextMissingStrategy = new DefaultContextMissingStrategy(); 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(); segmentContextResolverChain.addResolver(new LambdaSegmentContextResolver()); segmentContextResolverChain.addResolver(new ThreadLocalSegmentContextResolver()); awsRuntimeContext = new ConcurrentHashMap<>(); awsRuntimeContext.put("xray", SDK_VERSION_INFORMATION); serviceRuntimeContext = new ConcurrentHashMap<>(); serviceRuntimeContext.putAll(RUNTIME_INFORMATION); try { emitter = new DefaultEmitter(); } catch (SocketException e) { throw new RuntimeException("Unable to instantiate AWSXRayRecorder: ", e); } }
client.setThrowableSerializationStrategy(throwableSerializationStrategy); if (null != contextMissingStrategy && !AWSXRayRecorderBuilder.contextMissingStrategyFromEnvironmentVariable().isPresent() && !AWSXRayRecorderBuilder.contextMissingStrategyFromSystemProperty().isPresent()) { client.setContextMissingStrategy(contextMissingStrategy);
client.setThrowableSerializationStrategy(throwableSerializationStrategy); if (null != contextMissingStrategy && !AWSXRayRecorderBuilder.contextMissingStrategyFromEnvironmentVariable().isPresent() && !AWSXRayRecorderBuilder.contextMissingStrategyFromSystemProperty().isPresent()) { client.setContextMissingStrategy(contextMissingStrategy);