Skip to content
An ASP.NET Core middleware component which synchronises a correlation ID for cross API request logging.
C#
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
docs Tidy up release notes and package description Dec 20, 2019
samples/3.1
src/CorrelationId
test/CorrelationId.Tests
.gitattributes Initial Commit May 4, 2017
.gitignore Initial Commit May 4, 2017
.travis.yml
CorrelationId.sln Adding 3.0.0 release notes Dec 20, 2019
LICENSE.txt Initial Commit May 4, 2017
README.md
azure-pipelines.yml Update azure-pipelines.yml for Azure Pipelines Dec 19, 2019

README.md

Correlation ID

Correlations IDs are used in distributed applications to trace requests across multiple services. This library and package provides a lightweight correlation ID approach. When enabled, request headers are checked for a correlation ID from the consumer. If found, this correlation ID is attached to the Correlation Context which can be used to access the current correlation ID where it is required for logging etc.

Optionally, this correlation ID can be attached to downstream HTTP calls made via a HttpClient instance created by the IHttpClientFactory.

Release Notes

Change history and release notes.

Supported Runtimes

  • .NET Standard 2.0+
Package NuGet Stable NuGet Pre-release Downloads Travis CI Azure Pipelines
CorrelationId NuGet NuGet Nuget Build Status Build Status

Installation

You should install CorrelationId from NuGet:

Install-Package CorrelationId

This command from Package Manager Console will download and install CorrelationId and all required dependencies.

All stable and some pre-release packages are available on NuGet.

Usage

Examples in the wiki.

Known Issue with ASP.NET Core 2.2.0

It appears that a regression in the code for ASP.NET Core 2.2.0 means that setting the TraceIdentifier on the context via middleware results in the context becoming null when accessed further down in the pipeline. A fix is ready for 3.0.0 and the team plan to back-port this for the 2.2.2 release timeframe.

A workaround at this time is to disable the behaviour of updating the TraceIdentifier using the options when adding the middleware.

Support

If this library has helped you, feel free to buy me a coffee or see the "Sponsor" link at the top of the GitHub page.

You can’t perform that action at this time.