Skip to content

[instrumentation] consider dropping Instrumentation#disable() #5154

@pichlermarc

Description

@pichlermarc

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, which mocha 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 deprecate Instrumentation#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 of registerInstrumentations().
  • create create a type:feature-tracking follow-up for this repository (https://github.com/open-telemetry/opentelemetry-js) to remove the usages of disable() from tests
  • create create a type:feature-tracking follow-up for this repository (https://github.com/open-telemetry/opentelemetry-js) to remove the usages of disable() from tests

Additional Resources

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions