最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - How can Activity.Current.TraceId be the same for multiple requests? - Stack Overflow

programmeradmin3浏览0评论

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
发布评论

评论列表(0)

  1. 暂无评论