Exemplo n.º 1
0
 public ISpanContext Create(SpanContextPackage spanContextPackage)
 {
     return(new SpanContext(
                spanContextPackage.TraceId ?? RandomUtils.NextLong().ToString(),
                spanContextPackage.SpanId ?? RandomUtils.NextLong().ToString(),
                spanContextPackage.Sampled,
                spanContextPackage.Baggage ?? new Baggage(),
                spanContextPackage.References));
 }
Exemplo n.º 2
0
 public void Write(SpanContextPackage spanContext, ICarrier carrier)
 {
     if (carrier == null)
     {
         throw new ArgumentNullException(nameof(carrier));
     }
     carrier[TextMapCarrierHelpers.prefix_traceId] = spanContext.TraceId;
     carrier[TextMapCarrierHelpers.prefix_spanId]  = spanContext.SpanId;
     carrier[TextMapCarrierHelpers.prefix_sampled] = spanContext.Sampled.ToString();
     foreach (var item in spanContext.Baggage)
     {
         carrier[TextMapCarrierHelpers.prefix + item.Key] = item.Value;
     }
 }
Exemplo n.º 3
0
 public Task WriteAsync(SpanContextPackage spanContext, ICarrier carrier)
 {
     Write(spanContext, carrier);
     return(Task.FromResult(0));
 }