Esempio n. 1
0
        public static UpstreamSegment Map(SegmentRequest request)
        {
            var upstreamSegment = new UpstreamSegment();

            upstreamSegment.GlobalTraceIds.AddRange(request.UniqueIds.Select(MapToUniqueId).ToArray());

            var traceSegment = new TraceSegmentObject
            {
                TraceSegmentId        = MapToUniqueId(request.Segment.SegmentId),
                ApplicationId         = request.Segment.ServiceId,
                ApplicationInstanceId = request.Segment.ServiceInstanceId,
                IsSizeLimited         = false
            };

            traceSegment.Spans.Add(request.Segment.Spans.Select(MapToSpan).ToArray());

            upstreamSegment.Segment = traceSegment.ToByteString();
            return(upstreamSegment);
        }
        public UpstreamSegment Transform()
        {
            var upstreamSegment = new UpstreamSegment();

            upstreamSegment.GlobalTraceIds.AddRange(_relatedGlobalTraces.GetRelatedGlobalTraces()
                                                    .Select(x => x.ToUniqueId()));

            var traceSegment = new TraceSegmentObject {
                TraceSegmentId = TraceSegmentId.Transform()
            };

            traceSegment.Spans.AddRange(_spans.Select(x => x.Transform()));

            traceSegment.ApplicationId         = ApplicationId;
            traceSegment.ApplicationInstanceId = ApplicationInstanceId;
            traceSegment.IsSizeLimited         = _isSizeLimited;

            upstreamSegment.Segment = traceSegment.ToByteString();

            return(upstreamSegment);
        }