/// <summary> /// Processes Begin request by starting subsegment. /// </summary> private void ProcessBeginRequest(IExecutionContext executionContext) { var request = executionContext.RequestContext.Request; Entity entity = null; try { entity = _recorder.GetEntity(); } catch (EntityNotAvailableException e) { _recorder.TraceContext.HandleEntityMissing(_recorder, e, "Cannot get entity while processing AWS SDK request"); } var serviceName = RemoveAmazonPrefixFromServiceName(request.ServiceName); _recorder.BeginSubsegment(AWSXRaySDKUtils.FormatServiceName(serviceName)); _recorder.SetNamespace("aws"); entity = entity == null ? null : _recorder.GetEntity(); if (TraceHeader.TryParse(entity, out TraceHeader traceHeader)) { request.Headers[TraceHeader.HeaderKey] = traceHeader.ToString(); } else { _logger.DebugFormat("Failed to inject trace header to AWS SDK request as the segment can't be converted to TraceHeader."); } }
private bool ExcludeServiceOperation(IExecutionContext executionContext) { var requestContext = executionContext.RequestContext; var serviceName = RemoveAmazonPrefixFromServiceName(requestContext.Request.ServiceName); var operation = RemoveSuffix(requestContext.OriginalRequest.GetType().Name, "Request"); return(AWSXRaySDKUtils.IsBlacklistedOperation(serviceName, operation)); }