/// <summary> /// Converts a <see cref="LightStep.SpanContext" /> to a <see cref="SpanContext" /> /// </summary> /// <param name="ctx">A SpanContext</param> /// <returns>Proto SpanContext</returns> public SpanContext MakeSpanContextFromOtSpanContext(LightStep.SpanContext ctx) { SpanId = ctx.SpanIdValue; TraceId = ctx.TraceIdValue; ctx.GetBaggageItems().ToList().ForEach(baggage => Baggage.Add(baggage.Key, baggage.Value)); return(this); }
/// <summary> /// Converts a <see cref="LightStep.SpanContext" /> to a <see cref="SpanContext" /> /// </summary> /// <param name="ctx">A SpanContext</param> /// <returns>Proto SpanContext</returns> public SpanContext MakeSpanContextFromOtSpanContext(LightStep.SpanContext ctx) { try { SpanId = Convert.ToUInt64(ctx.SpanId); } catch (FormatException) { SpanId = Convert.ToUInt64(ctx.SpanId, 16); } try { TraceId = Convert.ToUInt64(ctx.TraceId); } catch (FormatException) { TraceId = Convert.ToUInt64(ctx.TraceId, 16); } ctx.GetBaggageItems().ToList().ForEach(baggage => Baggage.Add(baggage.Key, baggage.Value)); return(this); }