elastic / elastic/apm-agent-nodejs

Allow Transactions to disable spans

Open
#989 4 comments 0 reactions 0 assignees View on GitHub
agent-nodejs enhancement
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.**
I am having the problem, that i have a service which serves the two following purposes and i am not able to conditionally disable spans:
1. Background Worker
2. REST API to handle the worker and access resources

For the `Background Worker` i would like to be able to create custom transactions (which is working nicely) but do not want to have the default Spans (request, db, ...) enabled.
Instead, i would like to create only custom spans.

On the other hand, for incoming requests via the `REST API`, i would like to have the default spans enabled.

The problem is, that the `Background Worker` has several hundreds of requests/db operations/etc. in which i am really not interested and they are flooding Elasticsearch.
Instead, i am only interested in higher level spans of the custom transaction (e.g. (1) Get Data, (2) Processing Data, (3) Save Data, ...)

**Describe the solution you'd like**
Add an option to `Transaction` to disable the default spans or even better, use something like whitelisting / blacklisting array for the current transaction

```
const transaction = apm.startTransaction(name, type, {
disableInstrumentations: ['graphql', 'express-graphql'],
enableInstrumentations: ['http']
});
```
Using such a whitelisting / blacklisting, i gain full control over my custom transactions

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.