Skip to content

Use extended attributes everywhere #4587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
)
from opentelemetry.sdk.trace import Resource
from opentelemetry.sdk.util.instrumentation import InstrumentationScope
from opentelemetry.util.types import _ExtendedAttributes
from opentelemetry.util.types import Attributes

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -136,7 +136,7 @@ def _encode_trace_id(trace_id: int) -> bytes:


def _encode_attributes(
attributes: _ExtendedAttributes,
attributes: Attributes,
allow_null: bool = False,
) -> Optional[List[PB2KeyValue]]:
if attributes:
Expand Down
16 changes: 8 additions & 8 deletions opentelemetry-api/src/opentelemetry/_events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from opentelemetry.trace.span import TraceFlags
from opentelemetry.util._once import Once
from opentelemetry.util._providers import _load_provider
from opentelemetry.util.types import AnyValue, _ExtendedAttributes
from opentelemetry.util.types import AnyValue, Attributes

_logger = getLogger(__name__)

Expand All @@ -40,7 +40,7 @@ def __init__(
trace_flags: Optional["TraceFlags"] = None,
body: Optional[AnyValue] = None,
severity_number: Optional[SeverityNumber] = None,
attributes: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = None,
):
attributes = attributes or {}
event_attributes = {
Expand All @@ -65,7 +65,7 @@ def __init__(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = None,
):
self._name = name
self._version = version
Expand All @@ -88,7 +88,7 @@ def __init__(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = None,
):
super().__init__(
name=name,
Expand Down Expand Up @@ -125,7 +125,7 @@ def get_event_logger(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = None,
) -> EventLogger:
"""Returns an EventLoggerProvider for use."""

Expand All @@ -136,7 +136,7 @@ def get_event_logger(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = None,
) -> EventLogger:
return NoOpEventLogger(
name, version=version, schema_url=schema_url, attributes=attributes
Expand All @@ -149,7 +149,7 @@ def get_event_logger(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = None,
) -> EventLogger:
if _EVENT_LOGGER_PROVIDER:
return _EVENT_LOGGER_PROVIDER.get_event_logger(
Expand Down Expand Up @@ -211,7 +211,7 @@ def get_event_logger(
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = None,
event_logger_provider: Optional[EventLoggerProvider] = None,
) -> "EventLogger":
if event_logger_provider is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from opentelemetry.trace.span import TraceFlags
from opentelemetry.util._once import Once
from opentelemetry.util._providers import _load_provider
from opentelemetry.util.types import AnyValue, _ExtendedAttributes
from opentelemetry.util.types import AnyValue, Attributes

_logger = getLogger(__name__)

Expand All @@ -67,7 +67,7 @@ def __init__(
severity_text: Optional[str] = None,
severity_number: Optional[SeverityNumber] = None,
body: AnyValue = None,
attributes: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = 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: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = 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: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = 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: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = 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: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = 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: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = 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: Optional[_ExtendedAttributes] = None,
attributes: Optional[Attributes] = None,
) -> "Logger":
"""Returns a `Logger` for use within a python process.

Expand Down
Loading