apm-agent-dotnet icon indicating copy to clipboard operation
apm-agent-dotnet copied to clipboard

[BUG] APM transaction name is not consistent

Open ciizo opened this issue 2 years ago • 2 comments

APM Agent version

The version of the Elastic.Apm nuget package used : Elastic.Apm v. 1.16.1

Environment

Operating system and version: Windows 11 Pro v.22H2(Localhost) , Amazon Linux AMI 2.0.20221213 x86_64 ECS HVM GP2

.NET Framework/Core name and version : .NET 6.0, .NET 5.0, .NET Standard 2.0

Application Target Framework(s) : .NET 6.0

Describe the bug

Kibana version: 8.1.2 Elasticsearch version: 8.1.2 APM Server version: 8.1.2 APM Agent language and version: APM .NET 1.19.0 Browser version: Chrome 108.0.5359.125 (Official Build) (64-bit)

APM transaction name is misleading as follows

  • the transaction name of success request is formatted as “{HTTP method} {controller}/{method}”
  • the transaction name of failure request is formatted as “{HTTP method} {URL}”

I expect all transaction names to be formatted as “{HTTP method} {URL}”

I can fix this with a weird solution by setting the name at the beginning of request in simple middleware. Agent.Tracer.CurrentTransaction.Name = Agent.Tracer.CurrentTransaction.Name;

To Reproduce

Steps to reproduce the behavior:

  1. Use this config '...'

"ElasticApm": { "ServerUrls": "https://xxx.apm.us-central1.gcp.cloud.es.io:443", "SecretToken": "yyy", "TransactionSampleRate": 1.0, },

  1. Then call '....'

public static class ApmMiddlewareExtension { public static IApplicationBuilder UseAllElasticApm( this IApplicationBuilder builder, IConfiguration configuration = null ) => Elastic.Apm.AspNetCore.ApmMiddlewareExtension .UseElasticApm(builder, configuration, new HttpDiagnosticsSubscriber(), new EfCoreDiagnosticsSubscriber(), new SqlClientDiagnosticSubscriber(), new MongoDbDiagnosticsSubscriber()); }

  1. Then do '....' Test the API for getting some APM logs

  2. See error Here is my screenshot. image

Expected behavior

I expect all transaction names to be formatted as “{HTTP method} {URL}” also, from my debugging the name value is always “{HTTP method} {URL}” since beginning.

Actual behavior

APM transaction name is misleading as follows

  • the transaction name of success request is formatted as “{HTTP method} {controller}/{method}”
  • the transaction name of failure request is formatted as “{HTTP method} {URL}”

ciizo avatar Jan 11 '23 03:01 ciizo

Note the related Discuss question.

z1c0 avatar Jan 11 '23 06:01 z1c0

Bump! :)

do we have a followup on this

wickstargazer avatar Mar 20 '23 05:03 wickstargazer