Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MS_SubRoutes are not affecting Transaction names.

See original GitHub issue

APM Agent version

The version of the Elastic.Apm nuget package used: master branch directly, AspNetFullFrameworkSampleApp


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:

  1. Use AspNetFullFrameworkSampleApp from master branch (set default apm and kibana from for example Quick start guide
  2. Find AspNetFullFrameworkSampleApp.Controllers.WebApiController
  3. Add this sample controller method:
public class WebApiController : ApiController
	public IHttpActionResult AskMe(Guid someId) => Ok($"This is an example response from a web api controller: {someId}");
  1. Launch AspNetFullFrameworkSampleApp
  2. Use for example postman to request endpoint with dummy guid: image
  3. Find call in Kibana APM

Expected behavior

Transaction name is taken from subroute route template. image 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: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

russcamcommented, Feb 18, 2021

Thanks for opening @kszymanski. This seems like a reasonable change to include

insanity13commented, Feb 24, 2021

Unfortunately, I have not found a way to get information about the route in my case (in Request End).

  • .NET 4.7.2
  • ASP.NET Web App using OWIN Startup
    • System.Web.Http.Owin, Version=5.2.7
    • Microsoft.AspNet.WebApi, Version=5.2.7

Found only one option: to register the ActionFilter and get a template from ControllerContext. In this place, the template is correct.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found