-
Notifications
You must be signed in to change notification settings - Fork 913
Description
Description
Important
Do not start working on implementation yet. This is a feature-request
that's pending maintainer feedback for open questions.
Researching feasibility of this request and feedback is encouraged. If you do, please post your findings as a comment on this issue.
Every OpenTelemetry instrumentation has a disable()
functionality that allows users to call it to unwrap the library it's instrumenting on runtime.
[email protected]
introduced a change via nodejs/import-in-the-middle#153 which broke that functionality for ESM users. Since that version was released, we've not received a single report that this functionality is broken - which leads me to believe that this feature is of negligible value to our end-users, all while introducing additional complexity, points-of-failure and maintainance overhead to our @opentelemetry/instrumentation-*
packages and third-party instrumentations.
Internally this feature seems to be mainly intended for testing - we make extensive use of it though our projects in integration tests.
I propose we deprecate the functionality, make Instrumentation#disable()
optional and then gradually phase out use of it in our instrumentations and tests before eventually removing it altogether.
Possible ways to move forward
Before moving forward, we (@open-telemetry/javascript-maintainers) will have to find out if this is the path we want to go. If the answer is yes we need to:
- create a follow-up
type:research
issue to determine if removing disable from tests is even feasible. I suggest we use@opentelemetry/instrumentation-http
for this kind of experiment as it is the most feature-rich instrumentation.we may have to split tests that rely on wrapping with different options to different test files, whichmocha
will execute in different processes, which could make unwrap functionality unnecessary while reducing the amount of code-changes needed to accomplish the task.
If the outcome of this research is that it is feasible, we should:
- create a follow-up
type:feature
issue to deprecateInstrumentation#disable()
and make it optional in the interface.- Doing so will break
@opentelemetry/instrumentation
registerInstrumentations()
(old instrumentation may be used with the latest@opentelemetry/instrumentation
version, but instrumentations that depend on the latest version will not work with older versions ofregisterInstrumentations()
.
- Doing so will break
- create create a
type:feature-tracking
follow-up for this repository (https://github.com/open-telemetry/opentelemetry-js) to remove the usages ofdisable()
from tests - create create a
type:feature-tracking
follow-up for this repository (https://github.com/open-telemetry/opentelemetry-js) to remove the usages ofdisable()
from tests
Additional Resources
- import-in-the-middle PR that introduced the behavior that broke
disable
on ESM: fix: Support Hooking multiple times nodejs/import-in-the-middle#153 - PR to skip ESM disable tests in
@opentelemetry/instrumentation
: test(instrumentation): skip unwrap tests for esm #5153 - <please comment with links to any additional context and I'll add it here - I know that we talked about this somewhere else before but could not find the specific thread>