示例#1
0
        private WavefrontSpanContext CreateSpanContext()
        {
            Guid spanId = Guid.NewGuid();
            WavefrontSpanContext context = TraceAncestry();
            Guid traceId          = (context == null) ? Guid.NewGuid() : context.GetTraceId();
            bool?samplingDecision = context?.GetSamplingDecision();

            return(new WavefrontSpanContext(traceId, spanId, GetBaggage(), samplingDecision));
        }
 internal WavefrontSpan(
     WavefrontTracer tracer, string operationName, WavefrontSpanContext spanContext,
     DateTime startTimestampUtc, IList <Reference> parents, IList <Reference> follows,
     IList <KeyValuePair <string, string> > tags)
 {
     this.tracer            = tracer;
     this.operationName     = operationName;
     this.spanContext       = spanContext;
     this.startTimestampUtc = startTimestampUtc;
     this.parents           = parents;
     this.follows           = follows;
     this.tags = tags;
 }
        internal WavefrontSpan(
            WavefrontTracer tracer, string operationName, WavefrontSpanContext spanContext,
            DateTime startTimestampUtc, IList <Reference> parents, IList <Reference> follows,
            IList <KeyValuePair <string, string> > tags)
        {
            this.tracer            = tracer;
            this.operationName     = operationName;
            this.spanContext       = spanContext;
            this.startTimestampUtc = startTimestampUtc;
            this.parents           = parents;
            this.follows           = follows;
            this.spanLogs          = new List <SpanLog>();

            IList <KeyValuePair <string, string> > globalTags = tracer.Tags;

            if ((globalTags == null || globalTags.Count == 0) && (tags == null || tags.Count == 0))
            {
                this.tags = null;
            }
            else
            {
                this.tags = new List <KeyValuePair <string, string> >();
            }
            this.singleValuedTags = null;
            if (globalTags != null)
            {
                foreach (var tag in globalTags)
                {
                    SetTagObject(tag.Key, tag.Value);
                }
            }
            if (tags != null)
            {
                foreach (var tag in tags)
                {
                    SetTagObject(tag.Key, tag.Value);
                }
            }

            spansDiscarded = tracer.SdkMetricsRegistry?.Counter("spans.discarded");
        }