Пример #1
0
        private static TraceSegmentReference MapToSegmentReference(SegmentReferenceRequest referenceRequest)
        {
            var reference = new TraceSegmentReference
            {
                ParentApplicationInstanceId = referenceRequest.ParentServiceInstanceId,
                EntryApplicationInstanceId  = referenceRequest.EntryServiceInstanceId,
                ParentSpanId         = referenceRequest.ParentSpanId,
                RefType              = (RefType)referenceRequest.RefType,
                ParentTraceSegmentId = MapToUniqueId(referenceRequest.ParentSegmentId)
            };

            ReadStringOrIntValue(reference, referenceRequest.NetworkAddress, NetworkAddressReader, NetworkAddressIdReader);
            ReadStringOrIntValue(reference, referenceRequest.EntryEndpointName, EntryServiceReader, EntryServiceIdReader);
            ReadStringOrIntValue(reference, referenceRequest.ParentEndpointName, ParentServiceReader, ParentServiceIdReader);

            return(reference);
        }
        public TraceSegmentReference Transform()
        {
            TraceSegmentReference traceSegmentReference = new TraceSegmentReference();

            if (_type == SegmentRefType.CrossProcess)
            {
                traceSegmentReference.RefType = RefType.CrossProcess;
                traceSegmentReference.ParentApplicationInstanceId = _parentApplicationInstanceId;
                if (_peerId == DictionaryUtil.NullValue)
                {
                    traceSegmentReference.NetworkAddress = _peerHost;
                }
                else
                {
                    traceSegmentReference.NetworkAddressId = _peerId;
                }
            }
            else
            {
                traceSegmentReference.RefType = RefType.CrossThread;
            }

            traceSegmentReference.EntryApplicationInstanceId = _entryApplicationInstanceId;
            traceSegmentReference.ParentTraceSegmentId       = _traceSegmentId.Transform();
            traceSegmentReference.ParentSpanId = _spanId;
            if (_entryOperationId == DictionaryUtil.NullValue)
            {
                traceSegmentReference.EntryServiceName = _entryOperationName;
            }
            else
            {
                traceSegmentReference.EntryServiceId = _entryOperationId;
            }
            if (_parentOperationId == DictionaryUtil.NullValue)
            {
                traceSegmentReference.ParentServiceName = _parentOperationName;
            }
            else
            {
                traceSegmentReference.ParentServiceId = _parentOperationId;
            }
            return(traceSegmentReference);
        }