elastic / apm-agent-dotnet

https://www.elastic.co/guide/en/apm/agent/dotnet/current/index.html
Apache License 2.0
585 stars 208 forks source link

[BUG] APM transaction name is not consistent #1969

Open ciizo opened 1 year ago

ciizo commented 1 year ago

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

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

z1c0 commented 1 year ago

Note the related Discuss question.

wickstargazer commented 1 year ago

Bump! :)

do we have a followup on this