Beispiel #1
0
 public void Inject(ApplicationInsightsSpanContext context, ITextMap carrier)
 {
     carrier.Set(B3TraceId, context.TraceId);
     carrier.Set(B3SpanId, context.SpanId);
     if (context.ParentId != null)
     {
         carrier.Set(B3ParentId, context.ParentId);
     }
 }
Beispiel #2
0
        public void ShouldExtractAndInjectSpansViaB3()
        {
            var context = new ApplicationInsightsSpanContext(ThreadLocalRngIdProvider.NextId(), ThreadLocalRngIdProvider.NextId(), ThreadLocalRngIdProvider.NextId());
            var carrier = new Dictionary <string, string>();

            Tracer.Inject(context, BuiltinFormats.HttpHeaders, new TextMapInjectAdapter(carrier));
            var extracted =
                (ApplicationInsightsSpanContext)Tracer.Extract(BuiltinFormats.HttpHeaders,
                                                               new TextMapExtractAdapter(carrier));

            context.Should().BeEquivalentTo(extracted);
        }
        public void RootSpanContextShouldEqualSelf()
        {
            var context = new ApplicationInsightsSpanContext(ThreadLocalRngIdProvider.NextId(), ThreadLocalRngIdProvider.NextId());

            context.Equals(context).Should().BeTrue();
        }