Skip to content

Logs SDK: consider removing LogData and extending SDK LogRecord to have instrumentation scope #4313

@lmolkova

Description

@lmolkova

https://github.com/lmolkova/opentelemetry-python/blob/f6396062c3687cb33102a00b52607e9334ecdc85/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py#L255-L264

LogData does not serve any specific purpose besides adding instrumentation scope to the LogRecord.
It would be more efficient and easier to use if SDK version of the LogRecord included instrumentation scope and was used directly by the processing pipeline.

Spec allows this via

The SDK may also use a single type to represent both ReadableLogRecord and ReadWriteLogRecord.

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#additional-logrecord-interfaces

Specific changes:

  • SDK implementation of the LogRecord should have instrumentation scope property
  • SDK Logger implementation should populate instrumentation scope on the log record when it's created or emitted
  • LogRecordProcessor.on_emit should take LogRecord as a parameter
  • LogExporter.export should take Sequence[LogRecord] as parameters

See prototype in lmolkova@ac81b5e#diff-36f9acf9eab5e742a5a9c25b30236b688323375867ba50caf3fdea8ec6a7d91f

Part of open-telemetry/community#1751

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions