pinojs / pino

🌲 super fast, all natural json logger
http://getpino.io
MIT License
14.21k stars 875 forks source link

Log injection doesn't seem to be working with dd-trace #1495

Closed Ugikie closed 2 years ago

Ugikie commented 2 years ago

I have 2 separate projects, both using the exact same code for dd-trace and pino. One of the projects, shows the dd trace information in the output logs, while the other project does not. I am pretty new to both dd-trace and pino, but I cannot figure out why the dd object is not showing up in the logs.

dd-trace: v2.4.2 pino: v8.1.0

./logger.ts

import tracer from 'dd-trace'
import { pino } from 'pino'

tracer.init({ startupLogs: true, logInjection: true }) // initialized in a different file to avoid hoisting.

export const logger = pino()

./index.ts

import { logger } from './logger'

logger.error({ err: { message: 'test' } })

Output:

{"level":50,"time":1657932466511,"pid":32232,"hostname":"DESKTOP-OPPS0B5","err":{"message":"test"},"msg":"test"}

Desired Output:

{"level":50,"time":1657932882211,"pid":54284,"hostname":"DESKTOP-OPPS0B5","dd":{"trace_id":"2199711714951426111","span_id":"2195427521297530161","service":"test-api","version":"0.0.0"},"err":{"message":"test"},"msg":"test"}

Is there something I need to do in order for this information to be properly added onto the log message?

jsumners commented 2 years ago

We do not maintain the dd trace module. You will need to open an issue with them.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.