Remove TraceParent header from HttpClient requests

ASP.NET Core creates an Activity that represents the request by default. This is what tells HttpClient to send an outgoing request id header. You can disable it in a couple of ways:

By setting the current activity to null before making the request (Activity.Current = null)
By setting the environment variable DOTNET_SYSTEM_NET_HTTP_ENABLEACTIVITYPROPAGATION to "false" or "0".
By the AppContext switch System.Net.Http.EnableActivityPropagation to false

https://stackoverflow.com/questions/72277304/remove-traceparent-header-from-httpclient-requests

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章