Esempio n. 1
0
 public ISpanContext Create(SpanContextPackage spanContextPackage)
 {
     return(new SpanContext(
                spanContextPackage.TraceId ?? Guid.NewGuid().ToString(),
                spanContextPackage.SpanId ?? Guid.NewGuid().ToString(),
                spanContextPackage.Sampled,
                spanContextPackage.Baggage ?? new Baggage()));
 }
Esempio n. 2
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));
 }
Esempio n. 3
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;
     }
 }
Esempio n. 4
0
 public Task WriteAsync(SpanContextPackage spanContext, ICarrier carrier)
 {
     Write(spanContext, carrier);
     return(Task.FromResult(0));
 }