{"id":37055815,"url":"https://github.com/wdolek/w4k-aspnetcore-correlator","last_synced_at":"2026-01-14T06:18:04.804Z","repository":{"id":52493964,"uuid":"153684330","full_name":"wdolek/w4k-aspnetcore-correlator","owner":"wdolek","description":"Correlator, ASP.NET middleware for handling correlation/request ID.","archived":false,"fork":false,"pushed_at":"2025-11-17T22:07:16.000Z","size":391,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-17T23:26:01.486Z","etag":null,"topics":["correlation","forwarding-correlation"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wdolek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-10-18T20:36:05.000Z","updated_at":"2025-11-17T21:48:38.000Z","dependencies_parsed_at":"2024-01-15T21:34:28.896Z","dependency_job_id":"2a249df7-24d8-4268-9a67-1c2b18c553dc","html_url":"https://github.com/wdolek/w4k-aspnetcore-correlator","commit_stats":{"total_commits":173,"total_committers":1,"mean_commits":173.0,"dds":0.0,"last_synced_commit":"beb5e5eecc9ef037d4c5f2e446dc9a467a9a66fb"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/wdolek/w4k-aspnetcore-correlator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdolek%2Fw4k-aspnetcore-correlator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdolek%2Fw4k-aspnetcore-correlator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdolek%2Fw4k-aspnetcore-correlator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdolek%2Fw4k-aspnetcore-correlator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wdolek","download_url":"https://codeload.github.com/wdolek/w4k-aspnetcore-correlator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdolek%2Fw4k-aspnetcore-correlator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["correlation","forwarding-correlation"],"created_at":"2026-01-14T06:18:04.323Z","updated_at":"2026-01-14T06:18:04.795Z","avatar_url":"https://github.com/wdolek.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# W4k.AspNetCore.Correlator\n\n![W4k.AspNetCore.Correlator Build](https://github.com/wdolek/w4k-aspnetcore-correlator/workflows/Build%20and%20test/badge.svg)\n[![NuGet Version](https://img.shields.io/nuget/v/W4k.AspNetCore.Correlator)](https://www.nuget.org/packages/W4k.AspNetCore.Correlator/)\n\nCorrelator helps you with handling correlation ID (also \"request ID\"): reading, generating new one and forwarding\nto subsequent requests.\n\nCorrelation ID is sent within HTTP headers. If header is not set, Correlator will happily generate new one for you.\n\nApart from accepting or generating correlation ID, it is also possible to return correlation ID back to caller,\nso in case when correlation ID is generated, caller is aware of that value.\n\nTo forward correlation ID to subsequent request, it is necessary to use designated HTTP message handler, see\nexamples below.\n\n## W3 Trace Context and .NET\n\nBe aware that [Trace Context](https://www.w3.org/TR/trace-context/) is **not supported**,\nCorrelator helps you with simple non-standard headers.\n\nDistributed tracing and trace context is built in .NET, You can get more insights from article:\n[.NET distributed tracing](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/distributed-tracing).\n\n## Basic usage\n\n### Startup class\n\n```csharp\nvar builder = WebApplication.CreateBuilder(args);\nbuilder.Services.AddDefaultCorrelator();\n\nvar app = builder.Build();\n\n// register as first middleware\n// (or as soon as possible to benefit from having correlation ID)\napp.UseCorrelator();\n\n// ...\napp.Run();\n```\n\n### Accessing correlation ID\n\nCorrelation ID of current request is available via `ICorrelationContextAccessor.CorrelationContext`:\n\n```csharp\nusing W4k.AspNetCore.Correlator;\nusing W4k.AspNetCore.Correlator.Context;\n\npublic class MyLittleService\n{\n    private readonly ICorrelationContextAccessor _contextAccessor;\n\n    public MyLittleService(ICorrelationContextAccessor contextAccessor)\n    {\n        _contextAccessor = contextAccessor;\n    }\n\n    public async Task DoMagicalStuff()\n    {\n        CorrelationId correlationId = _contextAccessor.CorrelationContext.CorrelationId;\n\n        // ...\n    }\n}\n```\n\n## Forwarding correlation ID\n\nIn order to pass correlation ID to subsequent requests, additional HTTP message handler has to be registered.\n\nAdd `CorrelatorHttpMessageHandler` to HTTP client's message handler pipeline like this:\n\n```csharp\n// named HTTP client\nbuilder.Services\n    .AddHttpClient(\"DummyClient\")\n    .WithCorrelation();\n\n// typed HTTP client\nbuilder.Services\n    .AddHttpClient\u003cFooClient\u003e()\n    .WithCorrelation();\n\n// registering HTTP message handler manually\nbuilder.Services\n    .AddHttpClient(\"FizzClient\")\n    .AddHttpMessageHandler\u003cCorrelatorHttpMessageHandler\u003e();\n\n// registering HTTP client with custom settings\n// (global options - CorrelatorOptions.Forward - won't be used)\nbuilder.Services\n    .AddHttpClient\u003cLegacyClient\u003e()\n    .WithCorrelation(PropagationSettings.PropagateAs(\"X-Legacy-Correlation-Id\"));\n\n// ...\n```\n\nSee \"[Configure the HttpMessageHandler](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-2.1#configure-the-httpmessagehandler)\" for more details about usage of HTTP message handler.\n\n## Validation of correlation ID\n\nIt is possible to validate correlation ID value and prevent invalid value to spread. By default, validation is\nturned off. In order to turn validation on, implementation of `ICorrelationValidator` has to be registered.\n\nCorrelator is shipped with lightweight validator, `CorrelationValueLengthValidator`, which decides whether received\nvalue is valid simply based on its length.\n\n```csharp\nbuilder.Services\n    .AddDefaultCorrelator()\n    .WithValidator(new CorrelationValueLengthValidator(64));\n```\n\n## Documentation\n\n- [Detailed configuration](docs/configuration.md) description\n- [Dependency injection](docs/registration.md) registration\n- [Components](docs/components.md) description\n- [Alternative packages and further reading](docs/alternatives.md)\n\n---\n\nIcon made by [Kiranshastry](https://www.flaticon.com/authors/kiranshastry) from [Flaticon, www.flaticon.com](https://www.flaticon.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwdolek%2Fw4k-aspnetcore-correlator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwdolek%2Fw4k-aspnetcore-correlator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwdolek%2Fw4k-aspnetcore-correlator/lists"}