Skip to content

Commit 489fb85

Browse files
committed
Removing LogData
1 parent b7cda72 commit 489fb85

File tree

3 files changed

+3
-53
lines changed

3 files changed

+3
-53
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3838
- Set expected User-Agent in HTTP headers for grpc OTLP exporter
3939
([#4658](https://github.com/open-telemetry/opentelemetry-python/pull/4658))
4040
- Remove LogData and extend SDK LogRecord to have instrumentation scope
41-
([#](https://github.com/open-telemetry/opentelemetry-python/pull/))
41+
([#4676](https://github.com/open-telemetry/opentelemetry-python/pull/4676))
4242

4343
## Version 1.34.0/0.55b0 (2025-06-04)
4444

opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515

1616
from opentelemetry.sdk._logs._internal import (
17-
LogData,
1817
LogDeprecatedInitWarning,
1918
LogDroppedAttributesWarning,
2019
Logger,
@@ -26,7 +25,6 @@
2625
)
2726

2827
__all__ = [
29-
"LogData",
3028
"Logger",
3129
"LoggerProvider",
3230
"LoggingHandler",

opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -338,19 +338,6 @@ def dropped_attributes(self) -> int:
338338
return 0
339339

340340

341-
@deprecated(
342-
"Use LogRecord. Since logs are not stable yet this WILL be removed in future releases."
343-
)
344-
class LogData:
345-
def __init__(
346-
self,
347-
log_record: LogRecord,
348-
instrumentation_scope: InstrumentationScope,
349-
):
350-
self.log_record = log_record
351-
self.instrumentation_scope = instrumentation_scope
352-
353-
354341
class LogRecordProcessor(abc.ABC):
355342
"""Interface to hook the log record emitting action.
356343
@@ -406,23 +393,7 @@ def add_log_record_processor(
406393

407394
def on_emit(self, log_record: LogRecord) -> None:
408395
for lp in self._log_record_processors:
409-
# Handle backward compatibility with processors that might expect LogData
410-
import inspect
411-
412-
sig = inspect.signature(lp.on_emit)
413-
param_name = (
414-
list(sig.parameters.keys())[0] if sig.parameters else None
415-
)
416-
417-
# Check if the processor expects LogData (backward compatibility)
418-
if param_name and "log_data" in param_name.lower():
419-
# Create LogData for backward compatibility
420-
log_data = LogData(
421-
log_record, log_record.instrumentation_scope
422-
)
423-
lp.on_emit(log_data)
424-
else:
425-
lp.on_emit(log_record)
396+
lp.on_emit(log_record)
426397

427398
def shutdown(self) -> None:
428399
"""Shutdown the log processors one by one"""
@@ -495,26 +466,7 @@ def _submit_and_wait(
495466
future.result()
496467

497468
def on_emit(self, log_record: LogRecord):
498-
# Handle backward compatibility with processors that might expect LogData
499-
def _emit_with_compat(lp):
500-
import inspect
501-
502-
sig = inspect.signature(lp.on_emit)
503-
param_name = (
504-
list(sig.parameters.keys())[0] if sig.parameters else None
505-
)
506-
507-
# Check if the processor expects LogData (backward compatibility)
508-
if param_name and "log_data" in param_name.lower():
509-
# Create LogData for backward compatibility
510-
log_data = LogData(
511-
log_record, log_record.instrumentation_scope
512-
)
513-
return lp.on_emit(log_data)
514-
else:
515-
return lp.on_emit(log_record)
516-
517-
self._submit_and_wait(lambda lp: lambda: _emit_with_compat(lp))
469+
self._submit_and_wait(lambda lp: lp.on_emit, log_record)
518470

519471
def shutdown(self):
520472
self._submit_and_wait(lambda lp: lp.shutdown)

0 commit comments

Comments
 (0)