in sdk/src/Core/AWSXRayRecorderImpl.cs [152:186]
public void BeginSegment(string name, string traceId = null, string parentId = null, SamplingResponse samplingResponse = null, DateTime? timestamp = null)
{
#if !NETFRAMEWORK
if (AWSXRayRecorder.IsLambda())
{
throw new UnsupportedOperationException("Cannot override Facade Segment. New segment not created.");
}
#endif
Segment newSegment = new Segment(name, traceId, parentId);
if (samplingResponse == null)
{
SamplingInput samplingInput = new SamplingInput(name);
samplingResponse = SamplingStrategy.ShouldTrace(samplingInput);
}
if (!IsTracingDisabled())
{
if (timestamp == null)
{
newSegment.SetStartTimeToNow();
}
else
{
newSegment.SetStartTime(timestamp.Value);
}
PopulateNewSegmentAttributes(newSegment, samplingResponse);
}
newSegment.Sampled = samplingResponse.SampleDecision;
TraceContext.SetEntity(newSegment);
}