public static ISpan ConvertToSpan(SpanDto spanDto) { return(new Span { TraceId = Guid.Parse(spanDto.TraceId), SpanId = Guid.Parse(spanDto.SpanId), ParentSpanId = spanDto.ParentSpanId == null ? default(Guid?) : Guid.Parse(spanDto.ParentSpanId), BeginTimestamp = spanDto.BeginTimestamp, EndTimestamp = spanDto.EndTimestamp == null ? (DateTimeOffset?)null : spanDto.EndTimestamp, Annotations = spanDto.Annotations }); }
public static ISpan ConvertToSpan(SpanDto spanDto) { return(new Span { TraceId = Guid.Parse(spanDto.TraceId), SpanId = Guid.Parse(spanDto.SpanId), ParentSpanId = spanDto.ParentSpanId != null?Guid.Parse(spanDto.ParentSpanId) : default(Guid?), BeginTimestamp = CreateDateTimeOffset(spanDto.BeginTimestampUtc, spanDto.BeginTimestampUtcOffset), EndTimestamp = spanDto.EndTimestampUtc == 0 ? (DateTimeOffset?)null : CreateDateTimeOffset(spanDto.EndTimestampUtc, spanDto.EndTimestampUtcOffset), Annotations = spanDto.Annotations.ToDictionary(pair => pair.Key, pair => (object)pair.Value) }); }