Exemplo n.º 1
0
        public static void UndoApply(TraceInfo capturedContext)
        {
            if (capturedContext.span != null)
            {
                PopSpan();

                capturedContext.span.DurationInMicroseconds = TickClock.GetDuration(capturedContext.span.DurationInMicroseconds.Value);

                ZipkinConfig.Record(capturedContext.span);
            }
        }
Exemplo n.º 2
0
        public void Dispose()
        {
            if (Span != null)
            {
                Span.DurationInMicroseconds = TickClock.GetDuration(_start);

                TraceContextPropagation.PopSpan();

                ZipkinConfig.Record(Span);

                Span = null;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Starts a client trace.
        /// The <see cref="StandardAnnotationKeys.ClientSend"/> annotation is added by default.
        /// Give it a short lower-case description of the activity
        /// </summary>
        public StartClientTrace(string name, bool isDebug = false)
        {
            _skipDuration = false;

            var shouldSample = isDebug || ZipkinConfig.ShouldSample();

            if (shouldSample)
            {
                this._start = TickClock.Start();
                this.Span   = new Span(RandomHelper.NewId(), name, RandomHelper.NewId())
                {
                    IsDebug = isDebug
                };
                this.TimeAnnotateWith(PredefinedTag.ClientSend);

                TraceContextPropagation.PushSpan(this.Span);
            }
            else
            {
                this._start = 0;
                this.Span   = null;
            }
        }