Dotnet apm agent samples transactions locally but not when running on Azure App Service

Kibana version: 8.7.1

Elasticsearch version: 8.7.1 (Elastic Cloud)

APM Server version: 8.7.1

APM Agent language and version: Elastic APM dotnet Agent, v1.22.0

.Net Runtime: 6.0.16

Original install method (e.g. download page, yum, deb, from source, etc.) and version: Nuget

Fresh install or upgraded from other version? Upgraded from v1.17.0 (but downgrading does not fix the issue)

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

The APM agent for our Asp .Net Core application running on Azure App Service is not sampling transactions, so they are never sent to the APM server. It is successfully connecting to the server and sending metrics and errors correctly. When I run my application locally with the same configuration (same endpoint, same secret key) it will create transactions and send them to the APM server.

The following is logged by the middleware when a request is made:

2023-06-14T08:13:23.687262153Z [08:13:23 DBG] {ApmMiddleware} Incoming request with traceparent header. DistributedTracingData: DistributedTracingData{TraceId: c07b999234c2c9a3c5281f988cd8bf94, ParentId: 5639b18307fd76a3, FlagRecorded: False, TraceState: null}. Continuing trace.
2023-06-14T08:13:23.697050620Z [08:13:23 VRB] {Transaction} New Transaction instance created: Transaction{Id: 3f1542cf63709475, TraceId: c07b999234c2c9a3c5281f988cd8bf94, ParentId: 5639b18307fd76a3, Name: GET ***, Type: request, Outcome: Unknown, IsSampled: False}. IsSampled (False) and SampleRate (null) is based on incoming distributed tracing data (DistributedTracingData{TraceId: c07b999234c2c9a3c5281f988cd8bf94, ParentId: 5639b18307fd76a3, FlagRecorded: False, TraceState: null}). Start time: 2023-06-14 08:13:23.6869970 UTC (as timestamp: 1686730403686997)

It seems to me it decides not to sample it 'based on incoming distributed tracing data' but I have no idea what that means.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.

This config would solve this issue: HTTP configuration options | APM .NET Agent Reference [1.x] | Elastic

Here (under Note) there is more explanation on how this can happen: HTTP configuration options | APM .NET Agent Reference [1.x] | Elastic.