public void ShouldFallbackWhenExtractingWithFaultyCodec() { Tracer tracer = new Tracer.Builder("TracerResiliencyTestService") .WithReporter(new InMemoryReporter()) .WithSampler(new ConstSampler(true)) .RegisterCodec(BuiltinFormats.TextMap, new FaultyCodec()) .Build(); ISpanContext spanContext = tracer.Extract(BuiltinFormats.TextMap, new NoopTextMap()); Assert.Null(spanContext); }
public void TestDebugCorrelationId() { Tracer tracer = new Tracer.Builder("test") .WithReporter(new InMemoryReporter()) .WithSampler(new ConstSampler(true)) .Build(); var headers = new Dictionary <string, string>(); headers.Add(Constants.DebugIdHeaderKey, "Coraline"); ITextMap carrier = new TextMapExtractAdapter(headers); SpanContext spanContext = (SpanContext)tracer.Extract(BuiltinFormats.TextMap, carrier); Assert.True(spanContext.IsDebugIdContainerOnly()); Assert.Equal("Coraline", spanContext.DebugId); Span span = (Span)tracer.BuildSpan("span").AsChildOf(spanContext).Start(); spanContext = (SpanContext)span.Context; Assert.True(spanContext.IsSampled); Assert.True(spanContext.IsDebug); Assert.Equal("Coraline", span.GetTags()[Constants.DebugIdHeaderKey]); }