From dbe9b73d232707c0136569fe6b916b2acb1452bd Mon Sep 17 00:00:00 2001 From: Vivek Date: Thu, 4 Jul 2024 12:44:05 +0530 Subject: [PATCH] Add optional to the Attributes field --- .../src/opentelemetry/metrics/_internal/__init__.py | 2 +- .../src/opentelemetry/sdk/metrics/_internal/__init__.py | 2 +- opentelemetry-sdk/src/opentelemetry/sdk/util/instrumentation.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py b/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py index fdcce7ca718..e95e51b73e9 100644 --- a/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py +++ b/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py @@ -103,7 +103,7 @@ def get_meter( name: str, version: Optional[str] = None, schema_url: Optional[str] = None, - attributes: Attributes = None, + attributes: Optional[Attributes] = None, ) -> "Meter": """Returns a `Meter` for use by the given instrumentation library. diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/__init__.py index c0000fea36d..9dc95c0edb8 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/__init__.py @@ -519,7 +519,7 @@ def get_meter( name: str, version: Optional[str] = None, schema_url: Optional[str] = None, - attributes: Attributes = None, + attributes: Optional[Attributes] = None, ) -> Meter: if self._disabled: diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/util/instrumentation.py b/opentelemetry-sdk/src/opentelemetry/sdk/util/instrumentation.py index a292ded0365..a6fd7d7f66b 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/util/instrumentation.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/util/instrumentation.py @@ -150,7 +150,7 @@ def name(self) -> str: return self._name @property - def attributes(self) -> Optional[Attributes]: + def attributes(self) -> Attributes: return self._attributes def to_json(self, indent=4) -> str: