Skip to content

Commit 699ca43

Browse files
committed
Update LogRecord attributes typing to match reality
1 parent 35e2bfb commit 699ca43

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

opentelemetry-api/src/opentelemetry/_events/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(
5454
trace_flags=trace_flags,
5555
body=body,
5656
severity_number=severity_number,
57-
attributes=event_attributes, # type: ignore
57+
attributes=event_attributes,
5858
)
5959
self.name = name
6060

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from logging import getLogger
3838
from os import environ
3939
from time import time_ns
40-
from typing import Optional, cast
40+
from typing import Optional, Union, cast
4141

4242
from opentelemetry._logs.severity import SeverityNumber
4343
from opentelemetry.attributes import BoundedAttributes
@@ -68,7 +68,9 @@ def __init__(
6868
severity_text: Optional[str] = None,
6969
severity_number: Optional[SeverityNumber] = None,
7070
body: AnyValue = None,
71-
attributes: Optional[BoundedAttributes] = None,
71+
attributes: Optional[
72+
Union[BoundedAttributes, ExtendedAttributes]
73+
] = None,
7274
):
7375
self.timestamp = timestamp
7476
if observed_timestamp is None:
@@ -80,7 +82,7 @@ def __init__(
8082
self.severity_text = severity_text
8183
self.severity_number = severity_number
8284
self.body = body
83-
self.attributes: Optional[BoundedAttributes] = attributes
85+
self.attributes = attributes
8486

8587

8688
class Logger(ABC):

0 commit comments

Comments
 (0)