private Trace() { var traceId = RandomUtils.NextLong(); var traceIdHigh = TraceManager.Trace128Bits ? RandomUtils.NextLong() : 0; var spanId = RandomUtils.NextLong(); var isSampled = TraceManager.Sampler.Sample(traceId); CurrentSpan = new SpanState(traceIdHigh: traceIdHigh, traceId: traceId, parentSpanId: null, spanId: spanId, isSampled: isSampled, isDebug: false); CorrelationId = NumberUtils.LongToGuid(traceId); }
private Trace() { var traceId = RandomUtils.NextLong(); var traceIdHigh = TraceManager.Trace128Bits ? RandomUtils.NextLong() : 0; var spanId = RandomUtils.NextLong(); var isSampled = TraceManager.Sampler.Sample(traceId); var flags = SpanFlags.SamplingKnown; if (isSampled) { flags = flags | SpanFlags.Sampled; } CurrentSpan = new SpanState(traceIdHigh: traceIdHigh, traceId: traceId, parentSpanId: null, spanId: spanId, flags: flags); CorrelationId = NumberUtils.LongToGuid(traceId); }
public Record(SpanState spanState, DateTime timestamp, IAnnotation annotation) { _spanState = spanState; _timestamp = timestamp; _annotation = annotation; }
/// <summary> /// Creates a derived trace which inherits from /// the trace id and flags. /// It has a new span id and the parent id set to the current span id. /// </summary> /// <returns></returns> public Trace Child() { var childState = new SpanState(traceIdHigh: CurrentSpan.TraceIdHigh, traceId: CurrentSpan.TraceId, parentSpanId: CurrentSpan.SpanId, spanId: RandomUtils.NextLong(), isSampled: CurrentSpan.Sampled, isDebug: CurrentSpan.Debug); return(new Trace(childState)); }
/// <summary> /// Force this trace to be sent. /// </summary> public void ForceSampled() { CurrentSpan = new SpanState(traceIdHigh: CurrentSpan.TraceIdHigh, traceId: CurrentSpan.TraceId, parentSpanId: CurrentSpan.SpanId, spanId: RandomUtils.NextLong(), isSampled: true, isDebug: CurrentSpan.Debug); }
/// <summary> /// Creates a derived trace which inherits from /// the trace id and flags. /// It has a new span id and the parent id set to the current span id. /// </summary> /// <returns></returns> public Trace Child() { var childState = new SpanState(traceIdHigh: CurrentSpan.TraceIdHigh, traceId: CurrentSpan.TraceId, parentSpanId: CurrentSpan.SpanId, spanId: RandomUtils.NextLong(), flags: CurrentSpan.Flags); return(new Trace(childState)); }
private Trace(SpanState spanState) { CurrentSpan = spanState; CorrelationId = NumberUtils.LongToGuid(CurrentSpan.TraceId); }
/// <summary> /// Creates a trace from an existing span state. /// </summary> /// <param name="spanState"></param> /// <returns></returns> public static Trace CreateFromId(SpanState spanState) { return(new Trace(spanState)); }