Set proxy.forwarder activity DisplayName to request path#3031
Set proxy.forwarder activity DisplayName to request path#3031LindqvistMartin wants to merge 1 commit into
Conversation
|
@dotnet-policy-service agree |
|
Friendly ping. The red CI is unrelated flaky functional tests (HTTP/2 reset / socket abort), not from this change. Can rebase to re-trigger if useful. |
Yeah, my concern from the issue hasn't changed - #2667 (comment). If setting the name to the full path was a good idea to do by default, then why aren't we doing it in ASP.NET Core instead. This PR is also changing the activity that YARP emits and not the wrapping one ASP.NET creates, so presumably the dashboard would still show you lots of the same name as top-level traces, but with more informative child traces? |
|
Yeah, agreed on both. The rename only touches the And full path as the default name is the wrong call cardinality-wise, same reason ASP.NET Core stays away from it. Worse here since YARP routes are usually catch-all. Path's already on the activity as a tag anyway, so the data's there, it's just the default name. Since it's labelled Documentation, probably cleaner to add a short doc on setting DisplayName yourself from a custom middleware or an ActivityListener, for anyone who wants per-path names and is ok with the cardinality cost. I can write that up, or just close this, whatever you prefer. |
Fixes #2667.
The proxy.forwarder activity is created with a constant name, so every YARP request shows up under the same name in Aspire / OTel dashboards. This sets DisplayName to
Request.Pathso requests are distinguishable.OperationNamestays"proxy.forwarder"so anything filtering by activity name isn't affected. Empty paths keep the default.Added
Invoke_SetsActivityDisplayName_FromRequestPathinProxyPipelineInitializerMiddlewareTests. Verified it fails on main and passes with the change.The issue is tagged Type: Documentation — let me know if you'd rather close this in favor of a docs-only fix instead.