-
Notifications
You must be signed in to change notification settings - Fork 954
Description
Is your feature request related to a problem? Please describe.
I am attempting to use the OTel auto instrumentation for Javascript, but non-built-in modules are not patched because I am bundling my code with esbuild before deploying it into a docker container (same scenario as #2708).
Describe the solution you'd like
Provide bundler (esbuild, webpack, rollup, etc.) plugins as a means of instrumenting third party modules, since the existing require()-based patching does not work if you are bundling your code. This is somewhat of an alternative to #2708, with a big difference I see being that the bundler plugin could more easily apply to modules only when they're present. The proposed solution in that link seems much more manual to maintain in a codebase where we have many microservices with varying dependencies. I don't want to force developers to know they need to pass 20 aws modules to the OTel instrumentation just because they added an aws-s3 dependency.
Describe alternatives you've considered
- Allow module to be passed directly into plugins / bypass module hooks #2708
- Writing this esbuild plugin myself (code below).
Additional context
An initial implementation of this can be found at open-telemetry/opentelemetry-js-contrib#1856