Ejemplo n.º 1
0
 internal SpanContext(
     TraceId traceId,
     SpanId spanId,
     SpanId parentId,
     SpanContextFlags flags,
     IReadOnlyDictionary <string, string> baggage,
     string debugId)
 {
     TraceId  = traceId;
     SpanId   = spanId;
     ParentId = parentId;
     Flags    = flags;
     Baggage  = baggage ?? throw new ArgumentNullException(nameof(baggage));
     DebugId  = debugId;
 }
Ejemplo n.º 2
0
        public static SpanContext ContextFromString(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                throw new ArgumentException($"Cannot convert empty string to {nameof(SpanContext)}");
            }

            var parts = value.Split(':');

            if (parts.Length != 4)
            {
                throw new ArgumentException("String does not match tracer state format");
            }

            return(new SpanContext(
                       TraceId.FromString(parts[0]),
                       SpanId.FromString(parts[1]),
                       SpanId.FromString(parts[2]),
                       (SpanContextFlags)byte.Parse(parts[3], NumberStyles.HexNumber)));
        }
Ejemplo n.º 3
0
 public bool Equals(TraceId other)
 {
     return(High == other.High && Low == other.Low);
 }
Ejemplo n.º 4
0
 public SpanId(TraceId traceId)
 {
     Id = traceId.Low;
 }
Ejemplo n.º 5
0
 public SpanContext(TraceId traceId, SpanId spanId, SpanId parentId, SpanContextFlags flags)
     : this(traceId, spanId, parentId, flags, EmptyBaggage, debugId : null)
 {
 }