Exemple #1
0
        private static void TrackTrace(this TelemetryClient telemetryClient,
                                       Span span,
                                       Span.Types.TimeEvent evnt,
                                       Node peerInfo,
                                       string message,
                                       string ikey,
                                       IDictionary <string, AttributeValue> attributes = null)
        {
            TraceTelemetry trace = new TraceTelemetry(message);

            SetParentOperationContext(span, trace.Context.Operation);
            trace.Timestamp = evnt.Time?.ToDateTime() ?? DateTime.UtcNow;
            if (attributes != null)
            {
                foreach (var attribute in attributes)
                {
                    SetCustomProperty(trace.Properties, attribute);
                }
            }

            trace.Context.InstrumentationKey = ikey;

            SetPeerInfo(trace, peerInfo);
            telemetryClient.TrackTrace(trace);
        }
        private static void TrackTraceFromTimeEvent(this TelemetryClient telemetryClient, Span.Types.TimeEvent evnt, Span span, string ikey)
        {
            Span.Types.TimeEvent.Types.Annotation annotation = evnt.Annotation;
            if (annotation != null)
            {
                telemetryClient.TrackTrace(span, evnt, annotation.Description.Value, ikey,
                                           annotation.Attributes?.AttributeMap);
            }

            Span.Types.TimeEvent.Types.MessageEvent message = evnt.MessageEvent;
            if (message != null)
            {
                telemetryClient.TrackTrace(span, evnt,
                                           $"MessageEvent. messageId: '{message.Id}', type: '{message.Type}', compressed size: '{message.CompressedSize}', uncompressed size: '{message.UncompressedSize}'", ikey);
            }
        }