private static void Initialize(IApplicationBuilder app, AspNetCoreCorrelationConfiguration configuration)
        {
            var notifier = app.ApplicationServices.GetService(typeof(IOutgoingRequestNotifier <CorrelationContext, HttpRequestMessage, HttpResponseMessage>));

            if (notifier != null)
            {
                configuration.RequestNotifier = notifier as IOutgoingRequestNotifier <CorrelationContext, HttpRequestMessage, HttpResponseMessage>;
            }

            var instrumentaion = ContextTracingInstrumentation.Enable(configuration);

            var appLifetime = app.ApplicationServices.GetService(typeof(IApplicationLifetime)) as IApplicationLifetime;

            appLifetime?.ApplicationStopped.Register(() => instrumentaion?.Dispose());
        }
 /// <summary>
 /// Enables instrumentation of outgoing (and possibly incoming requests)
 /// Extracts <see cref="CorrelationContext"/> from incoming request and injects it to outgoing requests
 /// </summary>
 /// <param name="configuration">Instrumentation configuration <see cref="AspNetCoreConfiguration{TContext}"/></param>
 /// <returns><see cref="IDisposable"/> for the <see cref="DiagnosticListener"/> observers</returns>
 public static IDisposable Enable(AspNetCoreCorrelationConfiguration configuration)
 {
     return(Enable <CorrelationContext>(configuration));
 }