apm-agent-dotnet
apm-agent-dotnet copied to clipboard
Transaction name wrongly assigned NET461
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:
- Clone repo
- Replace the sample class
AttributeRoutingWebApiController
insample/AspNetFullFrameworkSampleApp
- Set the
LogLevel
toDebug
- Run project and call endpoint
route1/{route1:guid}/routes/process
- 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}");
}
}