MS_SubRoutes are not affecting Transaction names.
See original GitHub issueAPM 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:
- Use AspNetFullFrameworkSampleApp from
master
branch (set default apm and kibana from for example Quick start guide - Find
AspNetFullFrameworkSampleApp.Controllers.WebApiController
- Add this sample controller method:
[RoutePrefix("api/webapi")]
public class WebApiController : ApiController
{
...
[HttpGet]
[Route("{someId}")]
public IHttpActionResult AskMe(Guid someId) => Ok($"This is an example response from a web api controller: {someId}");
...
- Launch
AspNetFullFrameworkSampleApp
- Use for example postman to request endpoint with dummy guid:
- Find call in Kibana APM
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):
else if (routeValues.TryGetValue("MS_SubRoutes", out var template))
{
var subroute = ((IEnumerable<IHttpRouteData>)template).FirstOrDefault();
if(subroute != null)
{
name = subroute.Route.RouteTemplate;
}
}
Actual behavior
Guid is used as transaction name:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:15
- Comments:7 (2 by maintainers)
Top Results From Across the Web
MSSU - Frequently Asked Questions
Jump to your question: When should I expect to receive my bill? What is a student account? What if I need a bill...
Read more >Missouri Southern State University Employee Handbook
While no employee handbook can anticipate every circumstance or question about policy, every attempt has been made to ensure that this Handbook is...
Read more >2022-2023 Undergraduate Catalog
The teaching format for MSSU classes is subject to change at the university's discretion. Students should be prepared to handle alternative or on-line...
Read more >MSSU - Transfer Guide
Transfer policies posted apply only to how courses transfer into Missouri Southern State University. For questions about how Missouri Southern State ...
Read more >MSSU - Financial Responsibility Agreement
By reading then agreeing to the FRA, students acknowledge that they understand that enrollment in classes and/or receipt of some services will create...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for opening @kszymanski. This seems like a reasonable change to include
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.