Beispiel #1
0
        public static ISpanBuilder BeginSpan()
        {
            var traceReporter = Configuration.Reporter;

            if (traceReporter == null)
            {
                return(new FakeSpanBuilder());
            }

            var pooledSpan   = spanPool.AcquireHandle();
            var contextScope = TraceContextScope.Begin();

            return(new SpanBuilder(traceReporter, pooledSpan, contextScope, configuration));
        }
Beispiel #2
0
        public SpanBuilder(
            ITraceReporter traceReporter,
            PoolHandle <Span> spanHandle,
            TraceContextScope contextScope,
            ITraceConfiguration configuration)
        {
            this.traceReporter = traceReporter;
            this.spanHandle    = spanHandle;
            this.contextScope  = contextScope;
            this.configuration = configuration;

            stopwatch        = Stopwatch.StartNew();
            parentSpan       = Context.Properties.Get <Span>(spanContextKey);
            spanContextScope = Context.Properties.Use(spanContextKey, Span);

            InitializeSpan();
            EnrichSpanWithInheritedFields();
            EnrichSpanWithContext();
        }
Beispiel #3
0
 public static IDisposable Use(TraceContext context)
 {
     return(TraceContextScope.Begin(context));
 }