Repository navigation
fix(nodejs): bundle @opentelemetry/winston-transport so winston logs are exported - #2666
Open
vasireddy99 wants to merge 2 commits into
Open
vasireddy99 wants to merge 2 commits into
vasireddy99 wants to merge 2 commits into
Conversation
…are exported
The layer ships @opentelemetry/instrumentation-winston, but log sending
never worked. The instrumentation loads @opentelemetry/winston-transport
lazily with require() inside a try/catch, and that package is only a
devDependency of the instrumentation, so it was never installed into the
layer and webpack could not bundle it ("Can't resolve
'@opentelemetry/winston-transport'"). At runtime the require threw, the
instrumentation logged a diag warning hidden at the default log level,
and no winston log records were ever exported. Trace context injection
into winston records was unaffected, which made the gap easy to miss.
Add @opentelemetry/winston-transport as a layer dependency. Use ^0.32.0,
which depends on @opentelemetry/api-logs ^0.222.0 like the layer does, so
only one api-logs copy is installed and the transport sees the logger
provider the layer registers.
Add a wrapper test that enables the winston instrumentation, logs through
a real winston logger and asserts the record reaches the layer's logger
provider. It fails without the transport with the same warning users see.
Fixes open-telemetry#2065
Signed-off-by: Vasi Vasireddy <pvasir@amazon.com>
vasireddy99
marked this pull request as ready for review
October 13, 2026 20:42
Contributor
There was a problem hiding this comment.
Same feedback as #2517
I am little bit confused. If i look at https://www.npmjs.com/package/@opentelemetry/winston-transport it mentions
If using @opentelemetry/instrumenation-winston package there is no need to instantiate the transport as the instrumentation will take care of that.
If i then look at the docs for the instrumentation it doesn't use the transport package https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-winston.
Looking at the changes here i can't see what difference the additional package is making to what is released.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2065
What's wrong
The Node layer ships
@opentelemetry/instrumentation-winston, but winston log records are never exported.The instrumentation loads
@opentelemetry/winston-transportlazily, withrequire()inside atry/catch, when it patcheswinston.createLogger. That package is only a devDependency ofinstrumentation-winston, so it is never installed into the layer and webpack can't bundle it.Testing
I ran the tests locally on Node 20.18 with
--experimental-require-module.