Skip to content

Commit

Permalink
Move the Optional out of LogAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx committed Dec 24, 2024
1 parent 759b20a commit 57a6fb3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(
severity_text: Optional[str] = None,
severity_number: Optional[SeverityNumber] = None,
body: AnyValue = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
):
self.timestamp = timestamp
if observed_timestamp is None:
Expand All @@ -90,7 +90,7 @@ def __init__(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
) -> None:
super().__init__()
self._name = name
Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__( # pylint: disable=super-init-not-called
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
):
self._name = name
self._version = version
Expand Down Expand Up @@ -158,7 +158,7 @@ def get_logger(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
) -> Logger:
"""Returns a `Logger` for use by the given instrumentation library.
Expand Down Expand Up @@ -196,7 +196,7 @@ def get_logger(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
) -> Logger:
"""Returns a NoOpLogger."""
return NoOpLogger(
Expand All @@ -210,7 +210,7 @@ def get_logger(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
) -> Logger:
if _LOGGER_PROVIDER:
return _LOGGER_PROVIDER.get_logger(
Expand Down Expand Up @@ -273,7 +273,7 @@ def get_logger(
instrumenting_library_version: str = "",
logger_provider: Optional[LoggerProvider] = None,
schema_url: Optional[str] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
) -> "Logger":
"""Returns a `Logger` for use within a python process.
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-api/src/opentelemetry/util/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
...,
]

LogAttributes = Optional[Mapping[str, "AnyValue"]]
LogAttributes = Mapping[str, "AnyValue"]
2 changes: 1 addition & 1 deletion opentelemetry-api/tests/logs/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_logger(
name: str,
version: typing.Optional[str] = None,
schema_url: typing.Optional[str] = None,
attributes: LogAttributes = None,
attributes: typing.Optional[LogAttributes] = None,
) -> _logs.Logger:
return LoggerTest(name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def __init__(
severity_number: Optional[SeverityNumber] = None,
body: AnyValue = None,
resource: Optional[Resource] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
limits: Optional[LogLimits] = _UnsetLogLimits,
):
super().__init__(
Expand Down Expand Up @@ -633,7 +633,7 @@ def _get_logger_no_cache(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
) -> Logger:
return Logger(
self._resource,
Expand Down Expand Up @@ -667,7 +667,7 @@ def get_logger(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: LogAttributes = None,
attributes: Optional[LogAttributes] = None,
) -> Logger:
if self._disabled:
warnings.warn("SDK is disabled.")
Expand Down

0 comments on commit 57a6fb3

Please sign in to comment.