Skip to content

Commit 8772f4c

Browse files
authored
feat: Clarify the duplicate logging workaround
1 parent 24d8eab commit 8772f4c

File tree

1 file changed

+16
-1
lines changed
  • plugins/node/opentelemetry-instrumentation-winston

1 file changed

+16
-1
lines changed

plugins/node/opentelemetry-instrumentation-winston/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,22 @@ const logger = winston.createLogger({
139139
```
140140

141141
> [!IMPORTANT]
142-
> Logs will be duplicated if `@opentelemetry/winston-transport` is added as a transport in `winston` and `@opentelemetry/instrumentation-winston` is configured with `disableLogSending: false`.
142+
> 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`.
143+
> ```js
144+
>const { WinstonInstrumentation } = require('@opentelemetry/instrumentation-winston');
145+
>const { registerInstrumentations } = require('@opentelemetry/instrumentation');
146+
>registerInstrumentations({
147+
> instrumentations: [
148+
> new WinstonInstrumentation({
149+
> // Disable the duplicate logging from the auto instrumentation
150+
> disableLogSending: true
151+
> }),
152+
> ],
153+
>});
154+
>// Winston import must be after the WinstonInstrumentation creation
155+
>const { OpenTelemetryTransportV3 } = require('@opentelemetry/winston-transport');
156+
>const winston = require('winston');
157+
> ```
143158
144159
## Semantic Conventions
145160

0 commit comments

Comments
 (0)