Table of Contents

Class CorrelationIdRegistration

Namespace
Quilt4Net.Toolkit
Assembly
Quilt4Net.Toolkit.dll

Registration for forwarding the ambient Quilt4Net correlation id (X-Correlation-ID) on a consuming application's own outbound HTTP calls, so one id spans the app, the internal services it calls, and Quilt4Net.Server.

public static class CorrelationIdRegistration
Inheritance
CorrelationIdRegistration
Inherited Members

Methods

AddQuilt4NetCorrelationId(IHttpClientBuilder)

Opts a named/typed HttpClient into correlation-id propagation by attaching CorrelationIdHandler. Use on clients that call correlation-aware (typically your own internal) services:

services.AddHttpClient("internal-api").AddQuilt4NetCorrelationId();

Ensures the supporting services are registered, so a single call is enough.

public static IHttpClientBuilder AddQuilt4NetCorrelationId(this IHttpClientBuilder builder)

Parameters

builder IHttpClientBuilder

Returns

IHttpClientBuilder

AddQuilt4NetCorrelationId(IServiceCollection)

Registers the correlation-id propagation services: CorrelationIdHandler and a fallback ICorrelationIdAccessor (which forwards nothing). In an ASP.NET host, AddQuilt4NetLogging().AddHttpRequestLogging() (Quilt4Net.Toolkit.Api) replaces the accessor with one that reads the current request's correlation id from HttpContext.

public static IServiceCollection AddQuilt4NetCorrelationId(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

Remarks

This call alone does not attach propagation to any HttpClient. Opt a specific client in with AddQuilt4NetCorrelationId(IHttpClientBuilder) — propagation is per-client by design so an internal id is never leaked to third-party endpoints.