public void ShouldOverridePropagatorViaZipkinTracerOptions() { var tracerOptions = new ZipkinTracerOptions(Endpoint.Testing, new NoOpReporter()) { Propagator = new B3SingleHeaderPropagator() }; var tracer = new ZipkinTracer(tracerOptions); var traceId = Tracer.IdProvider.NextTraceId(); var context = new SpanContext(traceId, Tracer.IdProvider.NextSpanId(), Tracer.IdProvider.NextSpanId(), false, true); var carrier = new Dictionary <string, string>(); tracer.Inject(context, BuiltinFormats.HttpHeaders, new TextMapInjectAdapter(carrier)); carrier.Count.Should().Be(1); }
public void BugFix56NonZipkinContextShouldNotThrowUponInjectionAttempt() { // uses the MockZipkinTracer var carrier = new Dictionary <string, string>(); Tracer.Inject(NoOpZipkinSpanContext.Instance, BuiltinFormats.HttpHeaders, new TextMapInjectAdapter(carrier)); carrier.Count.Should().Be(0); // uses the real Zipkin tracer with a No-Op reporter var testTracer = new ZipkinTracer(new ZipkinTracerOptions( new Endpoint("test"), new NoOpReporter()) { ScopeManager = new AsyncLocalScopeManager() }); testTracer.Inject(NoOpZipkinSpanContext.Instance, BuiltinFormats.HttpHeaders, new TextMapInjectAdapter(carrier)); carrier.Count.Should().Be(0); }