in src/sdk/Utils/AgentUtil.cs [112:150]
public static void AddAutoInstrumentationMark()
{
try
{
var segment = AWSXRayRecorder.Instance.GetEntity() as Segment;
if (segment == null)
{
_logger.DebugFormat("Unable to retrieve Segment from trace context");
return;
}
IDictionary<string, object> awsAttribute = segment.Aws;
if (awsAttribute == null)
{
_logger.DebugFormat("Unable to retrieve AWS dictionary to set the auto instrumentation flag.");
}
else
{
ConcurrentDictionary<string, string> xrayAttribute = (ConcurrentDictionary<string, string>)awsAttribute["xray"];
if (xrayAttribute == null)
{
_logger.DebugFormat("Unable to retrieve X-Ray dictionary from AWS dictionary of segment.");
}
else
{
// Set attribute "auto_instrumentation":"true" in the "xray" section of the segment
xrayAttribute["auto_instrumentation"] = "true";
}
}
}
catch (EntityNotAvailableException e)
{
AWSXRayRecorder.Instance.TraceContext.HandleEntityMissing(AWSXRayRecorder.Instance, e, "Failed to get entity since it is not available in trace context while processing ASPNET Core request.");
}
}