public static void Main(string[] args)
        {
            FakeDiagnosticListenerObserver diagnosticListenerObserver = null;

            if (UseActivityToPropagateCv)
            {
                diagnosticListenerObserver = new FakeDiagnosticListenerObserver(kvp => { });

                // Enable three extension points to enable Correlation Vector tracking along with the
                // Activity and Request-Id
                //
                Activity.RegisterActivityExtension <CorrelationVectorExtension>();
                HttpClientHandler.RegisterCorrelationPropagationDelegate(
                    CorrelationVectorPropagationDelegates.FromCurrentActivityExtension);
                HostingApplication.RegisterCorrelationConsumer(new CorrelationVectorConsumer());
            }
            else
            {
                HttpClientHandler.RegisterCorrelationPropagationDelegate(
                    CorrelationVectorPropagationDelegates.FromHttpRequestMessageProperty);
                HostingApplication.RegisterCorrelationConsumer(new CorrelationVectorHttpContextConsumer());
            }

            // Issue a request to the controller to simulate a caller
            //
            Timer executeCallTimer = new Timer(IssueRequest, state: null, dueTime: 1500, period: Timeout.Infinite);

            using (diagnosticListenerObserver == null ?
                   null:
                   DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver))
            {
                CreateWebHostBuilder(args).Build().Run();
            }
        }
Пример #2
0
        public static void Main(string[] args)
        {
            // Enable three extension points to enable Correlation Vector tracking along with the
            // Activity and Request-Id
            Activity.RegisterActivityExtension <CorrelationVectorExtension>();
            HttpClientHandler.RegisterCorrelationPropagationDelegate(
                CorrelationVectorPropagationDelegates.FromCurrentActivityExtension);
            HostingApplication.RegisterCorrelationConsumer(new CorrelationVectorActivityExtensionConsumer());

            // Issue a request to the controller to simulate a caller
            //
            Timer executeCallTimer = new Timer(IssueRequest, state: null, dueTime: 1500, period: Timeout.Infinite);

            CreateWebHostBuilder(args).Build().Run();
        }