public static void setTraceEntity(Entity entity) { globalRecorder.setTraceEntity(entity); }
public static void setTraceEntity(Entity entity) { globalRecorder.setTraceEntity(entity); }
private void processEvent(AsyncEvent event) throws IOException { AWSXRayRecorder recorder = getRecorder(); Entity prior = recorder.getTraceEntity(); try { Entity entity = (Entity) event.getSuppliedRequest().getAttribute(ENTITY_ATTRIBUTE_KEY); recorder.setTraceEntity(entity); if (null != event.getThrowable()) { entity.addException(event.getThrowable()); } filter.postFilter(event.getSuppliedRequest(), event.getSuppliedResponse()); } finally { recorder.setTraceEntity(prior); } }
private void processEvent(AsyncEvent event) throws IOException { AWSXRayRecorder recorder = getRecorder(); Entity prior = recorder.getTraceEntity(); try { Entity entity = (Entity) event.getSuppliedRequest().getAttribute(ENTITY_ATTRIBUTE_KEY); recorder.setTraceEntity(entity); if (null != event.getThrowable()) { entity.addException(event.getThrowable()); } filter.postFilter(event.getSuppliedRequest(), event.getSuppliedResponse()); } finally { recorder.setTraceEntity(prior); } }
private Segment beginSegment(Segment segment) { SegmentContext context = getSegmentContext(); if (null == context) { return null; } Entity current; if ((current = getTraceEntity()) != null) { logger.error("Beginning new segment while another segment exists in the segment context. Overwriting current segment named '" + current.getName() + "' to start new segment named '" + segment.getName() + "'."); } segment.setAws(getAwsRuntimeContext()); if (null != getOrigin()){ segment.setOrigin(getOrigin()); } segment.putAllService(getServiceRuntimeContext()); setTraceEntity(segment); return context.beginSegment(this, segment); }
private Segment beginSegment(Segment segment) { SegmentContext context = getSegmentContext(); if (null == context) { return null; } Entity current; if ((current = getTraceEntity()) != null) { logger.error("Beginning new segment while another segment exists in the segment context. Overwriting current segment named '" + current.getName() + "' to start new segment named '" + segment.getName() + "'."); } segment.setAws(getAwsRuntimeContext()); if (null != getOrigin()){ segment.setOrigin(getOrigin()); } segment.putAllService(getServiceRuntimeContext()); setTraceEntity(segment); return context.beginSegment(this, segment); }
recorder.setTraceEntity(entityContext);
@Override public void beforeExecution(Context.BeforeExecution context, ExecutionAttributes executionAttributes) { AWSXRayRecorder recorder = getRecorder(); Entity origin = recorder.getTraceEntity(); Subsegment subsegment = recorder.beginSubsegment(executionAttributes.getAttribute((SdkExecutionAttribute.SERVICE_NAME))); if (subsegment == null) { return; } subsegment.setNamespace(Namespace.AWS.toString()); subsegment.putAws(EntityDataKeys.AWS.OPERATION_KEY, executionAttributes.getAttribute(SdkExecutionAttribute.OPERATION_NAME)); Region region = executionAttributes.getAttribute(AwsExecutionAttribute.AWS_REGION); if (region != null) { subsegment.putAws(EntityDataKeys.AWS.REGION_KEY, region.id()); } subsegment.putAllAws(extractRequestParameters(context, executionAttributes)); if (accountId != null) { subsegment.putAws(EntityDataKeys.AWS.ACCOUNT_ID_SUBSEGMENT_KEY, accountId); } recorder.setTraceEntity(origin); // store the subsegment in the AWS SDK's executionAttributes so it can be accessed across threads executionAttributes.putAttribute(entityKey, subsegment); }
@Override public void beforeExecution(Context.BeforeExecution context, ExecutionAttributes executionAttributes) { AWSXRayRecorder recorder = getRecorder(); Entity origin = recorder.getTraceEntity(); Subsegment subsegment = recorder.beginSubsegment(executionAttributes.getAttribute((SdkExecutionAttribute.SERVICE_NAME))); if (subsegment == null) { return; } subsegment.setNamespace(Namespace.AWS.toString()); subsegment.putAws(EntityDataKeys.AWS.OPERATION_KEY, executionAttributes.getAttribute(SdkExecutionAttribute.OPERATION_NAME)); Region region = executionAttributes.getAttribute(AwsExecutionAttribute.AWS_REGION); if (region != null) { subsegment.putAws(EntityDataKeys.AWS.REGION_KEY, region.id()); } subsegment.putAllAws(extractRequestParameters(context, executionAttributes)); if (accountId != null) { subsegment.putAws(EntityDataKeys.AWS.ACCOUNT_ID_SUBSEGMENT_KEY, accountId); } recorder.setTraceEntity(origin); // store the subsegment in the AWS SDK's executionAttributes so it can be accessed across threads executionAttributes.putAttribute(entityKey, subsegment); }