-
Notifications
You must be signed in to change notification settings - Fork 532
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
[instrumentation-winston] May duplicate transport (and logs) without notice #2283
Comments
Not totally sure the root cause here, but I've found removing the new OpenTelemetryTransportV3() from the createLogger seems to fix the duplicates. |
I wonder if the Bunyan instrumentation effectively will do the same. |
All,
In the original example here, both are being done, hence the duplicate transports. Two options for avoiding this: A. Improve the instrumentation-winston documentation to make this clear. Here is the equivalent documentation discussion for instrumentation-bunyan. Is that clearer for Bunyan users? My guess is the confusion comes from the This comment predicted some possible confusion. B. Consider having instrumentation-winston (by default, or optionally) skip adding I would initially be hesitant to do that. It gets into the realm of DWIM'ing that can lead to subtle surprises. Note that using |
Thanks @trentm
Will it be more confusing when I will add to that if we won't pass transports to winston, we will get an error log:
It seems to me that the structure of the description does not help in this case:
And then, there is an example where
If that won't be the case then maybe we should have more examples e.g. manual instrumentation that pretty much replicates const loggerProvider = new LoggerProvider({
resource: detectResourcesSync({
detectors: [envDetectorSync, processDetectorSync, hostDetectorSync],
}),
});
Thats one things but realms CJS/ESM is another problem but solvable I think. |
What version of OpenTelemetry are you using?
What version of Node are you using?
What did you do?
I found an issue while testing instrumentation-winston which may lead to duplicated logs (via duplicated transports).
To have logger working with logs exporter we may be tempted to follow [winston-transport/README.md#usage] (https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/packages/winston-transport/README.md#usage) guide, extended with exporter configuration (posted also in #2090) e.g.
And that will already cause a problem combined with instrumentation-winston because transport aren't deduplicated and instrumentation.ts#L220 adds it without deduplication even if transport is already there. Which in the end leads to duplicated logs in collector / APM.
What did you expect to see?
I expect that I won't have duplicated logs at the end.
What did you see instead?
I observed duplicated logs because instrumentation added another
OpenTelemetryTransportV3
to list of transports in winston instance.Additional context
Instrumentation code that adds transport:
instrumentation.ts#L220
The text was updated successfully, but these errors were encountered: