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;
 }
        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)));
        }
Esempio n. 3
0
 public bool Equals(TraceId other)
 {
     return(High == other.High && Low == other.Low);
 }
Esempio n. 4
0
 public SpanId(TraceId traceId)
 {
     Id = traceId.Low;
 }
 public SpanContext(TraceId traceId, SpanId spanId, SpanId parentId, SpanContextFlags flags)
     : this(traceId, spanId, parentId, flags, EmptyBaggage, debugId : null)
 {
 }