Skip to content
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

Transaction name wrongly assigned NET461 #1645

Closed
fabiobernalt opened this issue Mar 7, 2022 · 0 comments · Fixed by #1800
Closed

Transaction name wrongly assigned NET461 #1645

fabiobernalt opened this issue Mar 7, 2022 · 0 comments · Fixed by #1800
Assignees
Labels

Comments

@fabiobernalt
Copy link

fabiobernalt commented Mar 7, 2022

The transaction name in NET461 is wrongly assigned when there are two methods sharing a similar route. When the transaction name is set due to the hierarchy of the routes, it always takes the first one when calling the second endpoint.

Package: Elastic.Apm.AspNetFullFramework
Class: ElasticApmModule
Method: ProcessEndRequest

Steps to reproduce:

  1. Clone repo
  2. Replace the sample class AttributeRoutingWebApiController in sample/AspNetFullFrameworkSampleApp
  3. Set the LogLevel to Debug
  4. Run project and call endpoint route1/{route1:guid}/routes/process
  5. Check the transaction name is route1/{route1:guid}/routes/{route2} instead of the one requested
namespace AspNetFullFrameworkSampleApp.Controllers
{
	[RoutePrefix(RoutePrefix)]
	public class AttributeRoutingWebApiController : ApiController
	{
		public const string RoutePrefix = "route1/{route1:guid}/routes";
		public const string Route = "process";

		[HttpGet]
		[Route("{route2}")]
		public IHttpActionResult Get1([FromUri] Guid route1, Guid route2) =>
			Ok($"attributed routed web api controller {route1} and {route2}");

		[HttpGet]
		[Route(Route)]
		public IHttpActionResult Get2([FromUri] Guid route1) =>
			Ok($"attributed routed web api controller {route1}");
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants