/// <inheritdoc />
        public ISpan Start()
        {
            if (!startTimestampUtc.HasValue)
            {
                startTimestampUtc = tracer.CurrentTimestamp();
            }
            var globalTags = tracer.Tags;

            if (globalTags != null && globalTags.Count > 0)
            {
                tags.AddRange(globalTags);
            }
            var context = CreateSpanContext();

            return(new WavefrontSpan(tracer, operationName, context, startTimestampUtc.Value,
                                     parents, follows, tags));
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public ISpan Start()
        {
            if (!startTimestampUtc.HasValue)
            {
                startTimestampUtc = tracer.CurrentTimestamp();
            }
            var context = CreateSpanContext();

            if (!context.IsSampled())
            {
                // This indicates a root span and that no decision has been inherited from a parent
                // span.  Perform head based sampling as no sampling decision has been obtained for
                // this span yet.
                long traceId  = Utils.TraceIdToLong(context.GetTraceId());
                bool decision = tracer.Sample(operationName, traceId, 0);
                context = context.WithSamplingDecision(decision);
            }
            return(new WavefrontSpan(tracer, operationName, context, startTimestampUtc.Value,
                                     parents, follows, tags));
        }