Change8

v1.35.0

Breaking Changes
📦 opentelemetry-pythonView on GitHub →
1 breaking2 features🐛 6 fixes1 deprecations🔧 5 symbols

Summary

This release stabilizes the Log signal with several breaking changes and deprecations, including renaming `LogRecordProcessor.emit` to `on_emit` and deprecating explicit trace context arguments in favor of a context object for logging. It also updates OTLP exporters with improved timeout handling and jitter.

⚠️ 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, migrate from passing explicit `trace_id`, `span_id`, and `trace_flags` arguments to passing an optional `context` object. ([#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

⚡ 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])