I am currently writing an ASP.NET Core 8 service, and I am seeing strange behaviour (to me) using MVCs Activity.Current.TraceId
in my logs.
SO tells me that HttpContext.TraceIdentifier
changes per request. Fine. Folks also mention that Activity.Current.TraceId
holds for a given activity and can be used to capture subactivities as well. Also fine.
I am currently relying on MVC to instantiate Activity.Current.TraceId
as requests come in. I was expecting the value to be different per request but it seems to be holding many requests into our service.
Details: in these windows where the Activity.Current.TraceId
does not change, messages are coming from the same client making separate http requests. The only value it sets is x-ms-correlation-request-id
.
I have not tried any code changes.
Only did some research here:
- Difference between HttpContext.TraceIdentifier and Activity.Current.Id