close
The Wayback Machine - https://web.archive.org/web/20220407125954/https://github.com/pinojs/pino/issues/1292
Skip to content
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

Should provide an OpenTelemetry transport #1292

Open
jsumners opened this issue Jan 6, 2022 · 5 comments
Open

Should provide an OpenTelemetry transport #1292

jsumners opened this issue Jan 6, 2022 · 5 comments

Comments

@jsumners
Copy link
Member

@jsumners jsumners commented Jan 6, 2022

@marcbachmann
Copy link
Member

@marcbachmann marcbachmann commented Jan 6, 2022

Just a note. Currently I'm extracting the traceId in the pino-http customProps function: https://github.com/pinojs/pino-http/blob/0c778530cecac64ca80ae4e88624c55c942413b9/logger.js#L122

Having the traceId is enough in most cases, as that's the entrypoint of retrieving a trace in jaeger/loki.

Not sure this issue belongs into pino itself. Retrieving a trace might have too much overhead.

module.exports = pinoHttp({
  // ...,
  reqCustomProps (req) {
    return {traceId: req.traceId}
  }
})

Together with

    registerInstrumentations({
      instrumentations: [
        new DnsInstrumentation(),
        new ExpressInstrumentation(),
        new GrpcInstrumentation(),
        new HttpInstrumentation({
          requestHook (span, req) {
            req.traceId = span?.spanContext().traceId
          }
        }),
        new IORedisInstrumentation(),
        new PgInstrumentation({enhancedDatabaseReporting: true})
      ],
      meterProvider: metrics.meterProvider,
      tracerProvider: tracing.tracerProvider
    })

@jsumners
Copy link
Member Author

@jsumners jsumners commented Jan 7, 2022

The idea would be to receive a standard Pino generated NDJSON line and mutate it to the format described in the linked OT documentation. Adding trace/span ids is out of scope.

@jhonrocha
Copy link

@jhonrocha jhonrocha commented Feb 1, 2022

Hi! I will take a look on this!

@simoneb
Copy link
Contributor

@simoneb simoneb commented Feb 18, 2022

@jhonrocha any news?

@jhonrocha
Copy link

@jhonrocha jhonrocha commented Feb 18, 2022

Sorry, guys, I couldn't work on this yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants