Skip to content

Commit 57a6fb3

Browse files
committed
Move the Optional out of LogAttributes
1 parent 759b20a commit 57a6fb3

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(
6767
severity_text: Optional[str] = None,
6868
severity_number: Optional[SeverityNumber] = None,
6969
body: AnyValue = None,
70-
attributes: LogAttributes = None,
70+
attributes: Optional[LogAttributes] = None,
7171
):
7272
self.timestamp = timestamp
7373
if observed_timestamp is None:
@@ -90,7 +90,7 @@ def __init__(
9090
name: str,
9191
version: Optional[str] = None,
9292
schema_url: Optional[str] = None,
93-
attributes: LogAttributes = None,
93+
attributes: Optional[LogAttributes] = None,
9494
) -> None:
9595
super().__init__()
9696
self._name = name
@@ -119,7 +119,7 @@ def __init__( # pylint: disable=super-init-not-called
119119
name: str,
120120
version: Optional[str] = None,
121121
schema_url: Optional[str] = None,
122-
attributes: LogAttributes = None,
122+
attributes: Optional[LogAttributes] = None,
123123
):
124124
self._name = name
125125
self._version = version
@@ -158,7 +158,7 @@ def get_logger(
158158
name: str,
159159
version: Optional[str] = None,
160160
schema_url: Optional[str] = None,
161-
attributes: LogAttributes = None,
161+
attributes: Optional[LogAttributes] = None,
162162
) -> Logger:
163163
"""Returns a `Logger` for use by the given instrumentation library.
164164
@@ -196,7 +196,7 @@ def get_logger(
196196
name: str,
197197
version: Optional[str] = None,
198198
schema_url: Optional[str] = None,
199-
attributes: LogAttributes = None,
199+
attributes: Optional[LogAttributes] = None,
200200
) -> Logger:
201201
"""Returns a NoOpLogger."""
202202
return NoOpLogger(
@@ -210,7 +210,7 @@ def get_logger(
210210
name: str,
211211
version: Optional[str] = None,
212212
schema_url: Optional[str] = None,
213-
attributes: LogAttributes = None,
213+
attributes: Optional[LogAttributes] = None,
214214
) -> Logger:
215215
if _LOGGER_PROVIDER:
216216
return _LOGGER_PROVIDER.get_logger(
@@ -273,7 +273,7 @@ def get_logger(
273273
instrumenting_library_version: str = "",
274274
logger_provider: Optional[LoggerProvider] = None,
275275
schema_url: Optional[str] = None,
276-
attributes: LogAttributes = None,
276+
attributes: Optional[LogAttributes] = None,
277277
) -> "Logger":
278278
"""Returns a `Logger` for use within a python process.
279279

opentelemetry-api/src/opentelemetry/util/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@
5757
...,
5858
]
5959

60-
LogAttributes = Optional[Mapping[str, "AnyValue"]]
60+
LogAttributes = Mapping[str, "AnyValue"]

opentelemetry-api/tests/logs/test_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_logger(
2828
name: str,
2929
version: typing.Optional[str] = None,
3030
schema_url: typing.Optional[str] = None,
31-
attributes: LogAttributes = None,
31+
attributes: typing.Optional[LogAttributes] = None,
3232
) -> _logs.Logger:
3333
return LoggerTest(name)
3434

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def __init__(
181181
severity_number: Optional[SeverityNumber] = None,
182182
body: AnyValue = None,
183183
resource: Optional[Resource] = None,
184-
attributes: LogAttributes = None,
184+
attributes: Optional[LogAttributes] = None,
185185
limits: Optional[LogLimits] = _UnsetLogLimits,
186186
):
187187
super().__init__(
@@ -633,7 +633,7 @@ def _get_logger_no_cache(
633633
name: str,
634634
version: Optional[str] = None,
635635
schema_url: Optional[str] = None,
636-
attributes: LogAttributes = None,
636+
attributes: Optional[LogAttributes] = None,
637637
) -> Logger:
638638
return Logger(
639639
self._resource,
@@ -667,7 +667,7 @@ def get_logger(
667667
name: str,
668668
version: Optional[str] = None,
669669
schema_url: Optional[str] = None,
670-
attributes: LogAttributes = None,
670+
attributes: Optional[LogAttributes] = None,
671671
) -> Logger:
672672
if self._disabled:
673673
warnings.warn("SDK is disabled.")

0 commit comments

Comments
 (0)