Skip to content

[instrumentation-pino] Map Pino logger name to InstrumentationScope name per semconv #3373

@saitonakamura

Description

@saitonakamura
  • This only affects the JavaScript OpenTelemetry library
  • This may affect other libraries, but I would like to get opinions here first

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Description:

Problem

I'm currently using pino along with pino-debug (integration with https://www.npmjs.com/package/debug) and pino instrumentation. And while debug raises namespace to kind of first class thing, I'm struggling to understand how I should map it to otel semantic conventions (and whether I should do this at all)

Prior art behavior

in python instrumentation it's saying this https://opentelemetry-python.readthedocs.io/en/stable/sdk/_logs.html):

For log sources which define a logger name (e.g. logging.Logger.name) the Logger Name should be recorded as the instrumentation scope name.

If we would follow the same login, Pino does support naming loggers via the name option:

const logger = pino({ name: 'express:router' });
logger.info('handling request');

And the resulting OTel log record should have:

{
  "InstrumentationScope": {
    "Name": "express:router"
  }
}

The name/namespace field currently does pass through as a log record attribute, but I wonder if it should have some semantic convention for how logger names should be represented and whether it has anything to do with a Scope

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions