View on GitHub

Arcus Web API

Web API development with Microsoft Azure in a breeze

Telemetry Enrichment

Serilog Correlation Enrichment

The Arcus.WebApi.Telemetry.Serilog library provides a Serilog enricher that adds the correlation information of the current request to the log event as a log property called TransactionId and OperationId.



The enricher requires access to the application services so it can get the correlation information. Following example shows how the Serilog logger is configured in the Startup.cs file.

using Arcus.Observability.Correlation;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Serilog;

public class Startup
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        Log.Logger = new LoggerConfiguration()
            .Enrich.With(new CorrelationInfoEnricher(app.ApplicationServices))

← back