Change8

v1.35.0

Breaking Changes
📦 opentelemetry
1 breaking2 features🐛 6 fixes1 deprecations🔧 5 symbols

Summary

This release stabilizes the Log signal by introducing `event_name` for events and deprecating direct trace context fields in favor of a context object for log initialization. It also includes several fixes and updates to exporters and SDK components.

⚠️ Breaking Changes

  • The method `LogRecordProcessor.emit` has been renamed to `on_emit`. Users relying on reflection or direct calls to `emit` must update their code to use `on_emit` instead.

Migration Steps

  1. If you were calling `LogRecordProcessor.emit`, change calls to `LogRecordProcessor.on_emit`.
  2. When creating logs, use the optional `context` argument instead of passing `trace_id`, `span_id`, or `trace_flags` directly. ([#4597], [#4668])

✨ New Features

  • Added `event_name` as a top-level field in `LogRecord`. Events are now represented as logs with this field set, utilizing the logs SDK for emission. ([#4652])
  • Added `span_exporter` property back to `BatchSpanProcessor` class. ([#4621])

🐛 Bug Fixes

  • Fixed invalid `type: ignore` in opentelemetry-sdk that caused mypy to ignore the entire file. ([#4618])
  • Updated `ConsoleLogExporter.export` to correctly handle `LogRecord` bodies containing bytes type. ([#4614])
  • Fixed license field in `pyproject.toml` files. ([#4625])
  • Updated logger level to `NOTSET` in logs example. ([#4637])
  • SDK now uses context instead of `trace_id`, `span_id` for initializing `LogRecord`. ([#4653])
  • Set expected User-Agent in HTTP headers for gRPC OTLP exporter. ([#4658])

🔧 Affected Symbols

LogRecordProcessor.emitLogRecordProcessor.on_emitLogging API (log creation methods)BatchSpanProcessorConsoleLogExporter.export

⚡ Deprecations

  • The arguments `trace_id`, `span_id`, and `trace_flags` in the Logging API for log creation are deprecated in favor of passing an optional `context` object. ([#4597], [#4668])