diff --git a/opentelemetry-api/src/opentelemetry/util/types.py b/opentelemetry-api/src/opentelemetry/util/types.py index be171ef0ea..3864b7cc76 100644 --- a/opentelemetry-api/src/opentelemetry/util/types.py +++ b/opentelemetry-api/src/opentelemetry/util/types.py @@ -13,8 +13,11 @@ # limitations under the License. -from typing import Mapping, Optional, Sequence, Tuple, Union +from typing import Dict, List, Mapping, Optional, Sequence, Tuple, Union +AnyValue = Union[ + str, bool, int, float, bytes, List["AnyValue"], Dict[str, "AnyValue"], None +] AttributeValue = Union[ str, bool, diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py index 4dd5474302..b7e56eda38 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py @@ -22,7 +22,7 @@ import warnings from os import environ from time import time_ns -from typing import Any, Callable, Dict, List, Optional, Tuple, Union # noqa +from typing import Any, Callable, Optional, Tuple, Union # noqa from opentelemetry._logs import Logger as APILogger from opentelemetry._logs import LoggerProvider as APILoggerProvider @@ -50,7 +50,7 @@ get_current_span, ) from opentelemetry.trace.span import TraceFlags -from opentelemetry.util.types import Attributes +from opentelemetry.util.types import AnyValue, Attributes _logger = logging.getLogger(__name__) @@ -69,10 +69,6 @@ class LogDroppedAttributesWarning(UserWarning): warnings.simplefilter("once", LogDroppedAttributesWarning) -AnyValue = Union[ - str, bool, int, float, bytes, List["AnyValue"], Dict[str, "AnyValue"], None -] - class LogLimits: """This class is based on a SpanLimits class in the Tracing module.