Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#4979](https://github.com/open-telemetry/opentelemetry-python/pull/4979))
- `opentelemetry-sdk`: Map Python `CRITICAL` log level to OTel `FATAL` severity text per the specification
([#4984](https://github.com/open-telemetry/opentelemetry-python/issues/4984))
- `opentelemetry-sdk`: Optimize `LogRecord` memory in `BatchLogRecordProcessor` by clearing the `Context` object before buffering.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be transitioned to a TownCrier entry (mentioned elsewhere).

Please call out the potential breaking change in the changelog entry too.

([#4957](https://github.com/open-telemetry/opentelemetry-python/issues/4957))
- `opentelemetry-sdk`: Add file configuration support with YAML/JSON loading, environment variable substitution, and schema validation against the vendored OTel config JSON schema
([#4898](https://github.com/open-telemetry/opentelemetry-python/pull/4898))
- Fix intermittent CI failures in `getting-started` and `tracecontext` jobs caused by GitHub git CDN SHA propagation lag by installing contrib packages from the already-checked-out local copy instead of a second git clone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import abc
import copy
import enum
import logging
import sys
Expand All @@ -15,6 +16,7 @@
from opentelemetry.context import (
_ON_EMIT_RECURSION_COUNT_KEY,
_SUPPRESS_INSTRUMENTATION_KEY,
Context,
attach,
detach,
get_value,
Expand Down Expand Up @@ -317,8 +319,13 @@ def on_emit(self, log_record: ReadWriteLogRecord) -> None:
if log_record.resource is not None
else Resource.create({})
)
# Shallow copy the API log record to break the reference to the potentially large context
# while keeping the original context intact for other processors.
api_log_record = copy.copy(log_record.log_record)
api_log_record.context = Context()
Comment thread
ajuijas marked this conversation as resolved.
Comment thread
lzchen marked this conversation as resolved.

readable_log_record = ReadableLogRecord(
log_record=log_record.log_record,
log_record=api_log_record,
Comment thread
ajuijas marked this conversation as resolved.
resource=resource,
instrumentation_scope=log_record.instrumentation_scope,
limits=log_record.limits,
Expand Down