From e2b77783afac3748c07cb91b36fbd1dfe9db14e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Wed, 4 Sep 2024 10:09:15 +0200 Subject: [PATCH] Fix doc --- .../sdk/metrics/_internal/exemplar/exemplar.py | 6 +++++- .../sdk/metrics/_internal/exemplar/exemplar_filter.py | 8 ++++---- .../opentelemetry/sdk/metrics/_internal/measurement.py | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar.py index e460f38a481..2c570cc8b07 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar.py @@ -26,7 +26,7 @@ class Exemplar: was recorded, for example the span and trace ID of the active span when the exemplar was recorded. - Attributes: + Attributes trace_id: (optional) The trace associated with a recording span_id: (optional) The span associated with a recording time_unix_nano: The time of the observation @@ -37,6 +37,10 @@ class Exemplar: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#exemplars https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#exemplar """ + # TODO Fix doc - if using valid Google `Attributes:` key, the attributes are duplicated + # one will come from napoleon extension and the other from autodoc extension. This + # will raise an sphinx error of duplicated object description + # See https://github.com/sphinx-doc/sphinx/issues/8664 filtered_attributes: Attributes value: Union[int, float] diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar_filter.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar_filter.py index 0e090f9e359..8961d101efe 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar_filter.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar_filter.py @@ -42,7 +42,7 @@ def should_sample( ) -> bool: """Returns whether or not a reservoir should attempt to filter a measurement. - Attributes: + Args: value: The value of the measurement timestamp: A timestamp that best represents when the measurement was taken attributes: The complete set of measurement attributes @@ -69,7 +69,7 @@ def should_sample( ) -> bool: """Returns whether or not a reservoir should attempt to filter a measurement. - Attributes: + Args: value: The value of the measurement timestamp: A timestamp that best represents when the measurement was taken attributes: The complete set of measurement attributes @@ -96,7 +96,7 @@ def should_sample( ) -> bool: """Returns whether or not a reservoir should attempt to filter a measurement. - Attributes: + Args: value: The value of the measurement timestamp: A timestamp that best represents when the measurement was taken attributes: The complete set of measurement attributes @@ -122,7 +122,7 @@ def should_sample( ) -> bool: """Returns whether or not a reservoir should attempt to filter a measurement. - Attributes: + Args: value: The value of the measurement timestamp: A timestamp that best represents when the measurement was taken attributes: The complete set of measurement attributes diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement.py index a73d6001a1a..dad80577310 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement.py @@ -25,13 +25,17 @@ class Measurement: """ Represents a data point reported via the metrics API to the SDK. - Attributes: + Attributes value: Measured value time_unix_nano: The time the API call was made to record the Measurement instrument: The instrument that produced this `Measurement`. context: The active Context of the Measurement at API call time. attributes: Measurement attributes """ + # TODO Fix doc - if using valid Google `Attributes:` key, the attributes are duplicated + # one will come from napoleon extension and the other from autodoc extension. This + # will raise an sphinx error of duplicated object description + # See https://github.com/sphinx-doc/sphinx/issues/8664 value: Union[int, float] time_unix_nano: int