This question pertains to the Trace Context W3C recommendation that has been integrated into .NET, and the role that the HttpContext.TraceIdentifier property is destined to take in the future.
Is an Activity (using W3C) and HttpContext.TraceIdentifier mutually exclusive for logging and tracing purposes? Because they seem to overlap concerns fairly heavily.
By starting a new .NET API, are you best to just enable W3C and log the Trace / Span / Parent ids, rather than worrying about the trace identifier we've been using to date?
I understand that at:
Here's a JSON formatted log entry that's logging both the TraceIdentifier (i.e RequestId) as well as the Activity properties SpanId, TraceId and ParentId for reference.
{
"@t": "2021-08-13T17:00:10.7787030Z",
"@mt": "HTTP {RequestMethod} {RequestPath} responded {StatusCode} in {Elapsed:0.0000} ms",
"@r": [
"0.6127"
],
"UserId": "00000000-0000-0000-0000-000000000000",
"RequestMethod": "GET",
"RequestPath": "/",
"StatusCode": 200,
"Elapsed": 0.61267,
"SourceContext": "Serilog.AspNetCore.RequestLoggingMiddleware",
"SpanId": "332010586910af41",
"TraceId": "c9d2356397fdd64998690c709acf9a51",
"ParentId": "0000000000000000",
"RequestId": "0HMAUFETQ32F5:00000005",
"ConnectionId": "0HMAUFETQ32F5"
}