elastic / elastic/apm-agent-nodejs

Add instrumentation in libary vs. using `addPatch`?

Open
#1,778 0 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

I am currently trying to understand what would be the best way to add instrumentation for a database library, that I have access to:

a) Should we add some instrumentation code that starts and ends spans in our library
or
b) should we monkey patch our library via `addPatch` only when we actually want to instrument it?

Also, are there examples for both alternatives?
I found multiple PRs like https://github.com/elastic/apm-agent-nodejs/pull/1144/files that add support for a library here in the package itself, but that seems overkill for our custom library.

Thanks.

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.