Пример #1
0
 public void Inject <TCarrier>(ISpanContext spanContext, IFormat <TCarrier> format, TCarrier carrier)
 {
     if (spanContext is OTSpanContext ctx &&
         carrier is ITextMap map && zipkinTracer.PropagationRegistry.TryGet(typeof(TCarrier).Name, out var propagator))
     {
         propagator.Inject(ctx.TraceContext, Adapt.ToPropagatorMap(map));
     }
Пример #2
0
 public ISpanContext Extract <TCarrier>(IFormat <TCarrier> format, TCarrier carrier)
 {
     if (carrier is ITextMap map && zipkinTracer.PropagationRegistry.TryGet(typeof(TCarrier).Name, out var propagator))
     {
         var context = propagator.Extract(Adapt.ToPropagatorMap(map));
         return(context == null ? null : new OTSpanContext(context));
     }
     return(null);
 }