stevejgordon / CorrelationId

An ASP.NET Core middleware component which synchronises a correlation ID for cross API request logging.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is UpdateTraceIdentifier false by default?

VictorioBerra opened this issue · comments

CorrelationId and TraceId are basically the same thing. Dropping in this middleware should be an augmentation to the existing trace stuff in ASPNET Core. Why is this off by default?

Hi @VictorioBerra. It was simply a design decision to avoid unexpected behaviour changes to the built-in ASP.NET Core tracing.

The built-in tracing could be used without the need for the library at all. As the observability features from Microsoft evolve, I'd rather consumers explicitly opt-in to overriding those IDs as they are best placed to assess the impact it may have to their existing monitoring.

This library was created before the built in tracing and propagation of trace IDs was fully available. I still use it in my projects and based on downloads, so do many others. In my use cases, when using this library we simply ignore the Trace ID. My view is that if a team decide to use this library they can configure it to behave as they need. By default, it can run alongside the existing framework feature, but when desired it can be configured to interact.

I suspect we're talking about different IDs. The "UpdateTraceIdentifier" configuration controls whether the value for HttpContext.TraceIdentifier is updated or not. I suspect you're viewing the TraceId on the Activity? The Activity system is ASP.NET Core's work to support OpenTracing and is a distinct thing.

Ahhh yeah that was my confusion. I assumed the TraceId I see in my Serilog output is the trace identifier. And I assumed setting TraceIdentifier would update that. So, if I understand correctly now, HttpContext.TraceIdentifier is actually the Requestid which has a format of {ConnectionId}:{Request number} in my logs?