Anarchy.Toolkit.Infrastructure.CorrelationId
2.0.0
See the version list below for details.
dotnet add package Anarchy.Toolkit.Infrastructure.CorrelationId --version 2.0.0
NuGet\Install-Package Anarchy.Toolkit.Infrastructure.CorrelationId -Version 2.0.0
<PackageReference Include="Anarchy.Toolkit.Infrastructure.CorrelationId" Version="2.0.0" />
<PackageVersion Include="Anarchy.Toolkit.Infrastructure.CorrelationId" Version="2.0.0" />
<PackageReference Include="Anarchy.Toolkit.Infrastructure.CorrelationId" />
paket add Anarchy.Toolkit.Infrastructure.CorrelationId --version 2.0.0
#r "nuget: Anarchy.Toolkit.Infrastructure.CorrelationId, 2.0.0"
#:package Anarchy.Toolkit.Infrastructure.CorrelationId@2.0.0
#addin nuget:?package=Anarchy.Toolkit.Infrastructure.CorrelationId&version=2.0.0
#tool nuget:?package=Anarchy.Toolkit.Infrastructure.CorrelationId&version=2.0.0
Anarchy.Toolkit.Infrastructure.CorrelationId
Part of Anarchy I/O Toolkit, a .NET developer platform · Pillar: Infrastructure · Layer: Infrastructure · Package catalog
Provider-neutral correlation and attempt ID propagation for ASP.NET Core services, workers and message consumers.
dotnet add package Anarchy.Toolkit.Infrastructure.CorrelationId
- Access IDs through the async-flowing
CorrelationContext. - Add
UseCorrelationId()to the ASP.NET Core pipeline; headers default toX-Correlation-IdandX-Attempt-Idand are configurable. - Correlation and attempt IDs are added to standard
ILoggerscopes and the currentActivityas tags, so logging and tracing providers can consume them without a Serilog dependency. - Use
CorrelationContext.BeginScope()in workers and message consumers to set IDs and open the same provider-neutral scope for an operation.
When to use it
Use correlation and attempt IDs to connect log events and traces from the same request or retry across service boundaries. The package provides inbound HTTP middleware and a helper for non-HTTP entry points; it does not automatically configure every outgoing HTTP client or message publisher to forward IDs.
How to use it
- Register
ModuleCorrelationIdwith the application's configuration and environment. Pass aCorrelationIdOptionsfactory to customize header names, log property names or missing-header behavior. - Add
UseCorrelationId()early enough in the ASP.NET Core pipeline for later middleware and endpoints to see the context. - Use
CorrelationContext.BeginScope(logger, correlationId, attemptId)around worker or message-consumer work. It sets the async-flowing context, opens a standard logging scope and adds tags to the current activity.
The middleware and helper use both logging scopes and activity tags: scopes make the values available to any ILogger provider; tags make them available to tracing and OpenTelemetry pipelines. They do not use baggage, which would implicitly propagate values to downstream services. Use the optional Anarchy.Toolkit.Infrastructure.Telemetry.Serilog integration only when Serilog-specific event enrichment is needed.
The default behavior generates missing values. IgnoreIfMissing and ThrowIfMissing are available when the application instead wants to accept missing headers or reject them. Coordinate header names with upstream and downstream services.
See the observability guide and toolkit overview.
Releases
2.0.0
- feat(automation): establish onboarding and layering conventions
- feat(telemetry)!: introduce provider-neutral application telemetry
- refactor(packages)!: restructure persistence and automation packages
- refactor(infrastructure.correlationid)!: decouple correlation scopes from Serilog
- refactor(core)!: reshape telemetry, event and health contracts
- refactor(telemetry)!: remove legacy APIs and simplify namespaces
1.1.1
- docs(packages): identify each package's pillar and layer
- build(packages): attribute the copyright to Leandro Melão Medeiros
- build: relicense under Apache-2.0 and update the package metadata
1.1.0
- build(deps): upgrade Swashbuckle.AspNetCore to 11.0.1 and Microsoft.OpenApi to 3.11.1
1.0.6
- docs: expand XML docblocks across all projects for the DocFX API reference
1.0.5
- refactor(src): clean up code style across library packages
1.0.3
- build: migrate local automation to build tooling
1.0.2
- docs: expand package guides and release histories
1.0.1
- Added a package-specific NuGet README.
1.0.0
- Introduced correlation ID context and options, HTTP header propagation middleware, Serilog enrichment and dependency-injection wiring.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Anarchy.Toolkit.Core (>= 2.0.0)
- Humanizer (>= 3.0.10)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Anarchy.Toolkit.Infrastructure.CorrelationId:
| Package | Downloads |
|---|---|
|
Anarchy.Toolkit.Configuration
Application configuration: settings contracts, environment and secret handling, and the provider-neutral telemetry bootstrap (ModuleTelemetry) that applications extend through dependency injection. |
|
|
Anarchy.Toolkit.Infrastructure.Messaging.Aws
AWS SNS and SQS implementations of the message-broker publisher abstraction, with the shared publisher base, request-builder base, inbound mapping, and compression. |
|
|
Anarchy.Toolkit.Hosting.Workers
Worker pipeline: monitored/resilient background workers, heartbeat, and a self-hosted health API (service health reports, build metadata) for workers. |
|
|
Anarchy.Toolkit.Infrastructure.Telemetry.Serilog
Optional Serilog integration for Anarchy telemetry: logging provider registration, console defaults for composition roots, a structured-exception enricher and opt-in log-based metrics. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release.