-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handling of multipleInstrumentationNodeModuleDefinition
with the same name
#3
fix: handling of multipleInstrumentationNodeModuleDefinition
with the same name
#3
Conversation
Don't we still need to check
|
Indeed we do. I converted this PR to a draft exactly because I realized aws-sdk stopped working after these changes. |
} | ||
|
||
module.exports = mod; | ||
} catch (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we throw the underlying error to make any issues with this visible to users without requiring them to set the OTel diag log level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My opinion is that bugs in instrumentation (especially automatic) shouldn't break the service. I would like to surface the errors message of course.
I'm not sure what's idiomatic across otel, but I think this is a similar case to how auto-instrumentations-node
handles startup errors here: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/metapackages/auto-instrumentations-node/src/register.ts#L37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point + agree the consistency with auto instrumentations is good
@RafalSumislawski i'll merge if that works for you? |
Sure 👍 |
thanks again for the fix! |
When there are multiple
InstrumentationNodeModuleDefinition
s the urrent implementation chooses one of theInstrumentationNodeModuleDefinition
s in bunle-time and then in runtime selects it by name. This breaks when there are multipleInstrumentationNodeModuleDefinition
s with the same name, as the wrong one may be selected.This is the case with:
mongodb
- https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts#L96winston
- https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts#L48socket.io
- https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/instrumentation-socket.io/src/socket.io.ts#L218generic-pool
- https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-generic-pool/src/instrumentation.ts#L43This PR approaches the problem analogically to how
instrumentation.files
are handled. By iterating over the instrumentation in runtime and applying the ones with matching version.