elastic / apm-agent-nodejs

https://www.elastic.co/guide/en/apm/agent/nodejs/current/index.html
BSD 2-Clause "Simplified" License
581 stars 224 forks source link

Is there any plan to add a way to customize trace.id ? #4082

Open zurmokeeper opened 3 months ago

zurmokeeper commented 3 months ago

Is there any plan to add a way to customize trace.id, like the following:

const apm = require('elastic-apm-node').start({
    // Override service name from package.json
    // Allowed characters: a-z, A-Z, 0-9, -, _, and space
    serviceName: 'service',
    // Set custom APM Server URL (default: http://localhost:8200)
    serverUrl: APM_SERVER_URL,
});

apm.setTransactionName('xxx');

apm.setTraceId(customTraceId);   // This
trentm commented 3 months ago

@zurmokeeper No, there is no current plan to do this. What is the use case for doing this?

zurmokeeper commented 3 months ago

@trentm I need to bring a custom customTraceId when the client initiates a request, and then I need the apm's traceId to be equal to this one, so I can realize that from the client onwards, with the same id associated with the client, for me to find the logs will be much more convenient.