public TempSpan ConvertToTempSpan(Span span, DateTime stopUtc) { var myLocalSpan = new MySpan(); myLocalSpan.TraceId = span.Context.TraceId.ToString(); myLocalSpan.SpanId = span.Context.SpanId.ToString(); myLocalSpan.Flags = (int)span.Context.Flags; myLocalSpan.OpName = span.OperationName; var references = span.GetReferences(); foreach (var reference in references) { var myLocalReference = new MyLocalReference(); myLocalReference.Type = reference.Type; if (reference.Context != null) { myLocalReference.SpanID = reference.Context.SpanId.ToString(); myLocalReference.TraceID = reference.Context.TraceId.ToString(); } myLocalSpan.References.Add(myLocalReference); } myLocalSpan.StartTime = span.StartTimestampUtc; //public int Duration { get; set; } myLocalSpan.StopTime = stopUtc; var tags = span.GetTags(); foreach (var tag in tags) { myLocalSpan.Tags.Add(tag.Key, tag.Value); } var logs = span.GetLogs(); foreach (var log in logs) { myLocalSpan.Logs.Add(MyLogData.Create(log)); } var myProcess = new MyProcess(); myProcess.ServiceName = span.Tracer.ServiceName; foreach (var keyValuePair in span.Tracer.Tags) { myProcess.Tags.Add(keyValuePair.Key, keyValuePair.Value); } myLocalSpan.ProcessKey = myProcess.CreateKey(); var temp = new TempSpan(myProcess, myLocalSpan); return(temp); }
private SpanId TryFindParentId(MySpan mySpan) { var myLocalReferences = mySpan.References; if (myLocalReferences != null) { foreach (var reference in myLocalReferences) { //reference.Type may be lower case! if ("CHILD_OF".Equals(reference.Type, StringComparison.OrdinalIgnoreCase)) { return(SpanId.FromString(reference.SpanID)); } } } return(new SpanId()); }
public TempSpan(MyProcess process, MySpan span) { Process = process; Span = span; }