I have behavior that seems like a bug. Having pino-opentelemetry-transport as one of multiple targets breaks the app, unless I specify options, even empty one.
this does not work
const targets: any = [
{
target: 'pino/file',
level: LOG_LEVEL_FILE,
options: { destination: path.join(`${ROOT_DIR}/logs`, 'app.log'), mkdir: true },
},
{
target: 'pino-pretty',
level: LOG_LEVEL_CONSOLE,
options: { colorize: true },
},
{
target: 'pino-opentelemetry-transport',
level: LOG_LEVEL_OTEL,
}
];
const logger = pino(
{
transport: {
targets,
},
}
);
When I run the app I have error
throw er; // Unhandled 'error' event
^
TypeError: Cannot destructure property 'severityNumberMap' of 'undefined' as it is undefined.
at module.exports (/Users/myuser/workspace/project/myapp/backend/node_modules/pino-opentelemetry-transport/lib/pino-opentelemetry-transport.js:17:36)
at /Users/myuser/workspace/project/myapp/backend/node_modules/pino/lib/worker.js:83:28
at async Promise.all (index 2)
at async module.exports (/Users/myuser/workspace/project/myapp/backend/node_modules/pino/lib/worker.js:81:15)
at async start (/Users/myuser/workspace/project/myapp/backend/node_modules/thread-stream/lib/worker.js:67:17)
Emitted 'error' event on ThreadStream instance at:
at Immediate.<anonymous> (/Users/myuser/workspace/project/myapp/backend/node_modules/thread-stream/index.js:369:12)
at process.processImmediate (node:internal/timers:485:21)
Node.js v22.17.1
When I simply add empty options: {} to pino-opentelemetry-transport, it starts to work.
{
target: 'pino-opentelemetry-transport',
level: LOG_LEVEL_OTEL,
options: {}
}
and it logs properly to all the 3 targets.
I have behavior that seems like a bug. Having
pino-opentelemetry-transportas one of multiple targets breaks the app, unless I specifyoptions, even empty one.this does not work
When I run the app I have error
When I simply add empty
options: {}topino-opentelemetry-transport, it starts to work.and it logs properly to all the 3 targets.