elasticsearch – elastic RUM & APM Traces are not having same trace id

I came across the issue where I am not getting same trace id for RUM & APM transaction.

E.g., I initiate the transaction “add product to basket” and I get the transaction detail in APM (service – clothing) & RUM (service – clothing-rum) both but the transaction contains different trace id.

what we can do to get the same trace id?

My infrastructure configuration as below:

Application Hosted on: ASP. Net Core (dotnet6)

program.cs
using Elastic.Apm.NetCoreAll;

var configuration = GetConfiguration();app.UseAllElasticApm(configuration);

appsettings.json

"ElasticApm": {"ServerUrls": "https://XX.XX.XX.XX:8200","ServerCert": "~/lib/cert/ca.crt","VerifyServerCert": "false","SecretToken": "","ServiceName": "clothing","Environment": "DEV"}

RUM Configuration in html file

elasticApm.init({
    serviceName: 'clothing-rum',
    serverUrl: 'https://XX.XX.XX.XX:8200',
    SERVER_CERT: "\~/lib/cert/ca.crt",
    VerifyServerCert: "true",
    environment: 'DEV'
});

What have tried to solve issue

I tried setting up CORS policy in y APM server & setup the ditributedtracingorigins setting in RUM agent as below.

distributedTracingOrigins: \['https://localhost:9001', 'https://localhost:9000/%5C\*'\] `NA`

Read more here: Source link