示例#1
0
        private Trace()
        {
            var traceId = RandomUtils.NextLong();
            var spanId  = RandomUtils.NextLong();

            var isSampled = TraceManager.Sampler.Sample(traceId);

            var flags = SpanFlags.SamplingKnown;

            if (isSampled)
            {
                flags = flags | SpanFlags.Sampled;
            }

            CurrentSpan   = new SpanState(traceId: traceId, parentSpanId: null, spanId: spanId, flags: flags);
            CorrelationId = NumberUtils.LongToGuid(traceId);
        }
示例#2
0
        /// <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(traceId: CurrentSpan.TraceId, parentSpanId: CurrentSpan.SpanId, spanId: RandomUtils.NextLong(), flags: CurrentSpan.Flags);

            return(new Trace(childState));
        }
示例#3
0
 private Trace(SpanState spanState)
 {
     CurrentSpan   = spanState;
     CorrelationId = NumberUtils.LongToGuid(CurrentSpan.TraceId);
 }
示例#4
0
 /// <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));
 }
示例#5
0
 public Record(SpanState spanState, DateTime timestamp, IAnnotation annotation)
 {
     _spanState  = spanState;
     _timestamp  = timestamp;
     _annotation = annotation;
 }