in sdk/src/Core/AWSXRayRecorder.netcore.cs [397:424]
private void EndFacadeSegment()
{
try
{
// If the request is not sampled, a segment will still be available in TraceContext.
// Need to clean up the segment, but do not emit it.
FacadeSegment facadeSegment = (FacadeSegment)TraceContext.GetEntity();
if (!IsTracingDisabled())
{
PrepEndSegment(facadeSegment);
if (facadeSegment.RootSegment != null && facadeSegment.RootSegment.Size >= 0)
{
StreamingStrategy.Stream(facadeSegment, Emitter); //Facade segment is not emitted, all its subsegments, if emmittable, are emitted
}
}
TraceContext.ClearEntity();
}
catch (EntityNotAvailableException e)
{
HandleEntityNotAvailableException(e, "Failed to end facade segment because cannot get the segment from trace context.");
}
catch (InvalidCastException e)
{
HandleEntityNotAvailableException(new EntityNotAvailableException("Failed to cast the entity to Facade segment.", e), "Failed to cast the entity to Facade Segment.");
}
}