Exemple #1
0
            public void ConfigureServices(IServiceCollection services)
            {
                services.AddDefaultCorrelator(options =>
                {
                    options.ReadFrom.Clear();
                    options.ReadFrom.Add("X-Correlation-Id");

                    options.Factory = (_) => CorrelationId.FromString("le_correlation");
                    options.Emit    = PropagationSettings.PropagateAs("X-Correlation-Id");
                    options.ReplaceTraceIdentifier = false;
                    options.LoggingScope           = LoggingScopeSettings.IncludeLoggingScope("Correlation");
                });
            }
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDefaultCorrelator(options =>
            {
                options.Emit = PropagationSettings.KeepIncomingHeaderName();
                options.ReplaceTraceIdentifier = true;
                options.LoggingScope           = LoggingScopeSettings.IncludeLoggingScope();

                options.ReadFrom.Add("X-Correlation");
                options.ReadFrom.Add("X-Request");
                options.ReadFrom.Add("X-Trace-Id");
            });
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDefaultCorrelator(options =>
            {
                options.Forward      = PropagationSettings.PropagateAs("X-Correlation-Id");
                options.Emit         = PropagationSettings.PropagateAs("X-Correlation-Id");
                options.LoggingScope = LoggingScopeSettings.IncludeLoggingScope("Correlation");
            });

            services
            .AddHttpClient("DummyClient")
            .WithCorrelation();

            services.AddControllers();
        }
        public void ConfigureServices(IServiceCollection services) =>
        services.AddDefaultCorrelator(
            o =>
        {
            // disable correlation ID factory
            // (if correlation ID not sent, ASP.NET trace ID is going to be used)
            o.Factory = null;

            // read custom header
            o.ReadFrom.Clear();
            o.ReadFrom.Add("X-CID");

            // do not emit correlation ID
            o.Emit = PropagationSettings.KeepIncomingHeaderName();

            // overwrite `HttpContext.TraceIdentifier` by correlation ID
            o.ReplaceTraceIdentifier = true;

            // enable logging scope containing correlation ID
            o.LoggingScope = LoggingScopeSettings.IncludeLoggingScope("Correlation");
        });