Esempio n. 1
0
        void CreateAndTrackDependencyTelemetry(TraceContextBase requestTraceContext)
        {
            TraceContextBase dependencyTraceContext = TraceContextFactory.Create(TraceConstants.Client);

            dependencyTraceContext.TelemetryType = TelemetryType.Dependency;
            dependencyTraceContext.SetParentAndStart(requestTraceContext);

            CorrelationTraceContext.Current = dependencyTraceContext;

            // Correlation
            CorrelationTraceClient.TrackDepencencyTelemetry(dependencyTraceContext);
            CorrelationTraceClient.TrackRequestTelemetry(requestTraceContext);
        }
Esempio n. 2
0
        TraceContextBase CreateOrExtractRequestTraceContext(string eventName)
        {
            TraceContextBase requestTraceContext = null;

            if (Activity.Current == null) // It is possible that the caller already has an activity.
            {
                requestTraceContext = TraceContextFactory.Create($"{TraceConstants.Client}: {eventName}");
                requestTraceContext.StartAsNew();
            }
            else
            {
                requestTraceContext = TraceContextFactory.Create(Activity.Current);
            }

            return(requestTraceContext);
        }