elastic / elastic/apm-agent-nodejs

How can I create traceId and start/end time when using elastic APM API?

Open
#2,011 6 comments 0 reactions 0 assignees View on GitHub
agent-nodejs
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I am using https://github.com/elastic/apm-agent-nodejs in a node application to send trace data to Elastic APM Server.
```
const getApm = (serviceName = 'my-service') =>
require('elastic-apm-node').start({
serviceName,
serverUrl:
'server url',
});

const apm = getApm();
apm.startTransaction('transaction1');
apm.startSpan(...)
```
I will send trace data to APM server and I am able to view them via Kibana. The trace id, start/end time is calculated by APM client or server. H

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

I'd like to use the API in this way:

```
apm.startTransaction('name', { startTime: xxx, endTime: xxx, traceId})

apm.startSpan('name', { startTime: xxx, endTime: xxx})
...
```

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.