private static SpanObject MapToSpan(SpanRequest request) { var spanObject = new SpanObject { SpanId = request.SpanId, ParentSpanId = request.ParentSpanId, StartTime = request.StartTime, EndTime = request.EndTime, SpanType = (SpanType)request.SpanType, SpanLayer = (SpanLayer)request.SpanLayer, IsError = request.IsError }; ReadStringOrIntValue(spanObject, request.Component, ComponentReader, ComponentIdReader); ReadStringOrIntValue(spanObject, request.OperationName, OperationNameReader, OperationNameIdReader); ReadStringOrIntValue(spanObject, request.Peer, PeerReader, PeerIdReader); spanObject.Tags.Add(request.Tags.Select(x => new KeyWithStringValue { Key = x.Key, Value = x.Value })); spanObject.Refs.AddRange(request.References.Select(MapToSegmentReference).ToArray()); spanObject.Logs.AddRange(request.Logs.Select(MapToLogMessage).ToArray()); return(spanObject); }
private void SelectCode(SpanObject codeSpan) { if (codeSpan != null && ChangeCodeSpanRequest != null) { ChangeCodeSpanRequest(codeSpan, EventArgs.Empty); } }
public virtual SpanObject Transform() { SpanObject spanObject = new SpanObject(); spanObject.SpanId = _spanId; spanObject.ParentSpanId = _parnetSpanId; spanObject.StartTime = _startTime; spanObject.EndTime = _endTime; if (_operationId != DictionaryUtil.NullValue) { spanObject.OperationNameId = _operationId; } else { spanObject.OperationName = _operationName; } if (IsEntry) { spanObject.SpanType = SpanType.Entry; } else if (IsExit) { spanObject.SpanType = SpanType.Exit; } else { spanObject.SpanType = SpanType.Local; } if (_layer.HasValue) { spanObject.SpanLayer = (NetworkProtocol.SpanLayer)((int)_layer.Value); } if (_componentId != DictionaryUtil.NullValue) { spanObject.ComponentId = _componentId; } else { spanObject.Component = _componentName; } spanObject.IsError = _errorOccurred; if (_tags != null) { spanObject.Tags.Add(_tags.Select(x => new KeyWithStringValue { Key = x.Key, Value = x.Value })); } if (_logs != null) { spanObject.Logs.Add(_logs.Select(x => x.Transform())); } if (_refs != null) { spanObject.Refs.Add(_refs.Select(x => x.Transform())); } return(spanObject); }