elastic / elastic/apm-agent-nodejs

Autodetect modules to instrument

Open
#312 0 comments 0 reactions 0 assignees View on GitHub
agent-nodejs enhancement low hanging fruit
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

Currently for a module to be automatically instrumented by this agent, there needs to be both a js file with the same name as the module under `lib/instrumentation/modules` and the name of the modules needs to be added to the [`MODULES`](https://github.com/elastic/apm-agent-nodejs/blob/dd20f63cfc56f3078c5e24e56a0f58a2d859a999/lib/instrumentation/index.js#L16) array.

Likewise, if the tests for the instrumentation are placed in a subdirectory inside `test/instrumentation/modules` that directory needs to be added to the [`directories`](https://github.com/elastic/apm-agent-nodejs/blob/dd20f63cfc56f3078c5e24e56a0f58a2d859a999/test/test.js#L65-L76) array.

It would make sense to automate this, so that these files and directories were just automatically detected when requiring the module and running the tests.

For the tests, I don't think we can get rid of the `directories` array completely as we'd like to ignore certain directories, but if we could add glob support to the entries in the array that would solve it.

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.