[英]Wrong ParentId in ASP.NET Core 3.1?
我正在測試 ASP.NET Core 3.1 中的跟蹤是如何工作的,但有些東西不起作用。 我有 3 個 ASP.NET 核心應用程序(Node1、Node2、Node3),啟用了 ActivityIdFormat.W3C,調用層次結構是使用 httpclient 的 Node1->Node2->Node3。 當調用 Node2 時,它具有正確的 ParentId,它等於來自 Node1 的 SpanId。 但是當從 Node2 ParentId 調用 Node3 時是錯誤的。 在每個節點的日志下方 - 您可以看到我還轉儲了標頭,看起來從 Node2 發送的標頭是錯誤的。 我在 .NET 5 中看到了相同的行為,但是當我簽入 .NET 3.1 時,沒有 ActivityIdFormat.W3C 父節點在所有節點上傳播。
{
"@t": "2021-03-03T14:14:28.1125178Z",
"@mt": "Test on Node 1 with {@Headers}",
"@l": "Error",
"Headers": "[Connection, keep-alive], [Accept, */*], [Accept-Encoding, gzip, deflate, br], [Host, localhost:5001], [Referer, http://localhost:5000/WeatherForecast?test=three], [User-Agent, PostmanRuntime/7.26.10], [Postman-Token, 566e895a-efc9-440d-9cc2-d3272a59f08e]",
"SourceContext": "TraceTest.Controllers.WeatherForecastController",
"ActionId": "8322cc4b-f499-4292-ad92-95edf9932274",
"ActionName": "TraceTest.Controllers.WeatherForecastController.Get (TraceTest)",
"RequestId": "0HM6U9QJT75QA:00000001",
"RequestPath": "/WeatherForecast",
"SpanId": "c0e4e78f0ab2684f",
"TraceId": "532c5503c7def848953038f49ba81918",
"ParentId": "0000000000000000",
"ConnectionId": "0HM6U9QJT75QA"
}
{
"@t": "2021-03-03T14:14:28.5933479Z",
"@mt": "Test on Node 2 with {@Headers}",
"@l": "Error",
"Headers": "[Host, localhost:5011], [traceparent, 00-532c5503c7def848953038f49ba81918-c0e4e78f0ab2684f-00]",
"SourceContext": "TraceTest.Controllers.WeatherForecastController",
"ActionId": "47ec867a-b69b-49bf-91d2-4aeb089fe7d6",
"ActionName": "TraceTest.Controllers.WeatherForecastController.Get (TraceTestNode2)",
"RequestId": "0HM6U9QK2GI54:00000001",
"RequestPath": "/WeatherForecast",
"SpanId": "65583073c1fa3644",
"TraceId": "532c5503c7def848953038f49ba81918",
"ParentId": "c0e4e78f0ab2684f",
"ConnectionId": "0HM6U9QK2GI54"
}
{
"@t": "2021-03-03T14:14:29.0369082Z",
"@mt": "Test on Node 3 with {@Headers}",
"@l": "Error",
"Headers": "[Host, localhost:5021], [traceparent, 00-532c5503c7def848953038f49ba81918-ffcefa1bb1710340-00]",
"SourceContext": "TraceTest.Controllers.WeatherForecastController",
"ActionId": "c475354c-ba74-4f45-b9d4-57362a3b8899",
"ActionName": "TraceTest.Controllers.WeatherForecastController.Get (TraceTestNode3)",
"RequestId": "0HM6U9QK6QAPH:00000001",
"RequestPath": "/WeatherForecast",
"SpanId": "262cbf3f566d9044",
"TraceId": "532c5503c7def848953038f49ba81918",
"ParentId": "ffcefa1bb1710340",
"ConnectionId": "0HM6U9QK6QAPH"
}
源代碼可以在這里找到https://github.com/dominikjeske/Samples/tree/main/TraceTest
此問題已在 github https://github.com/dotnet/aspnetcore/issues/30595上的此問題中解決
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.