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)); }
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(); }
public static IDisposable Use(TraceContext context) { return(TraceContextScope.Begin(context)); }