-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MS_SubRoutes are not affecting Transaction names. #1176
Comments
Thanks for opening @kszymanski. This seems like a reasonable change to include |
This commit updates ElasticApmModule to get the transaction name for a Web API controller routed with attribute routing from the "MS_SubRoutes" route data value. A delegate to get the template from IHttpRouteData when System.Web.Http is referenced. Closes elastic#1176
Thank you @russcam! Looking forward to 1.9.0 release! |
@kszymanski Could you tell me why RouteData might be empty? |
@insanity13 the
|
@insanity13 I'm sorry but I don't know why. I had myself a problem with Route attribute and APM that did not see correct route name so I debug it and google around. That is how I found article about |
Unfortunately, I have not found a way to get information about the route in my case (in Request End).
Found only one option: to register the ActionFilter and get a template from ControllerContext. In this place, the template is correct. |
This commit updates ElasticApmModule to get the transaction name for a Web API controller routed with attribute routing from the "MS_SubRoutes" route data value. A delegate to get the template from IHttpRouteData when System.Web.Http is referenced. Closes elastic#1176
This commit updates ElasticApmModule to get the transaction name for a Web API controller routed with attribute routing from the "MS_SubRoutes" route data value. A delegate to get the template from IHttpRouteData when System.Web.Http is referenced. Closes #1176
APM Agent version
The version of the
Elastic.Apm
nuget package used: master branch directly,AspNetFullFrameworkSampleApp
Environment
Operating system and version: Windows Version 10.0.19042.804
.NET Framework/Core name and version (e.g. .NET 4.6.1, NET Core 3.1.100) : .NET 4.6.1
Application Target Framework(s) (e.g. net461, netcoreapp3.1): net461
Describe the bug
Transaction names are generated from
request.Unvalidated.Path
for WebApi routes that have[Route]
attribute on it.To Reproduce
Steps to reproduce the behavior:
master
branch (set default apm and kibana from for example Quick start guideAspNetFullFrameworkSampleApp.Controllers.WebApiController
AspNetFullFrameworkSampleApp
Expected behavior
Transaction name is taken from subroute route template.

Example fix would be in
Elastic.Apm.Model.Transaction.GetNameFromRouteContext(IDictionary<string, object> routeValues)
you can add another if statement (around line 546):Actual behavior
Guid is used as transaction name:

The text was updated successfully, but these errors were encountered: