-
Notifications
You must be signed in to change notification settings - Fork 584
feat: Clarify the duplicate logging workaround #2831
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
Open
vordimous
wants to merge
1
commit into
open-telemetry:main
Choose a base branch
from
vordimous:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+16
−1
Conversation
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
trentm
reviewed
Jul 2, 2025
Comment on lines
+142
to
+157
> Logs will be duplicated if `@opentelemetry/winston-transport` is added as a transport in `winston` and `@opentelemetry/instrumentation-winston` is configured with `disableLogSending: false`. You must import `winston` after you have called `registerInstrumentations`. | ||
> ```js | ||
>const { WinstonInstrumentation } = require('@opentelemetry/instrumentation-winston'); | ||
>const { registerInstrumentations } = require('@opentelemetry/instrumentation'); | ||
>registerInstrumentations({ | ||
> instrumentations: [ | ||
> new WinstonInstrumentation({ | ||
> // Disable the duplicate logging from the auto instrumentation | ||
> disableLogSending: true | ||
> }), | ||
> ], | ||
>}); | ||
>// Winston import must be after the WinstonInstrumentation creation | ||
>const { OpenTelemetryTransportV3 } = require('@opentelemetry/winston-transport'); | ||
>const winston = require('winston'); | ||
> ``` |
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.
@vordimous How about this wording:
Suggested change
> Logs will be duplicated if `@opentelemetry/winston-transport` is added as a transport in `winston` and `@opentelemetry/instrumentation-winston` is configured with `disableLogSending: false`. You must import `winston` after you have called `registerInstrumentations`. | |
> ```js | |
>const { WinstonInstrumentation } = require('@opentelemetry/instrumentation-winston'); | |
>const { registerInstrumentations } = require('@opentelemetry/instrumentation'); | |
>registerInstrumentations({ | |
> instrumentations: [ | |
> new WinstonInstrumentation({ | |
> // Disable the duplicate logging from the auto instrumentation | |
> disableLogSending: true | |
> }), | |
> ], | |
>}); | |
>// Winston import must be after the WinstonInstrumentation creation | |
>const { OpenTelemetryTransportV3 } = require('@opentelemetry/winston-transport'); | |
>const winston = require('winston'); | |
> ``` | |
> Logs will be **duplicated** if `OpenTelemetryTransportV3` is explicitly added as a Winston logger transport **and** `@opentelemetry/instrumentation-winston` is active with the [Log sending](#log-sending) feature (the default). If you are both using `OpenTelemetryTransportV3` and instrumentation-winston, be sure to either disable instrumentation-winston completely, or disable its Log sending feature (`disableLogSending: false`). For examle: | |
> | |
> ```js | |
> const { WinstonInstrumentation } = require('@opentelemetry/instrumentation-winston'); | |
> const { registerInstrumentations } = require('@opentelemetry/instrumentation'); | |
> registerInstrumentations({ | |
> instrumentations: [ | |
> new WinstonInstrumentation({ | |
> disableLogSending: true | |
> }), | |
> ], | |
> }); | |
> const { OpenTelemetryTransportV3 } = require('@opentelemetry/winston-transport'); | |
> // Winston import must be after the WinstonInstrumentation creation | |
> const winston = require('winston'); | |
> | |
> // ... | |
> const logger = winston.createLogger(...); | |
> ``` |
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.
Which problem is this PR solving?
OpenTelemetryTransportV3
to format my payload correctly.Short description of the changes