diff --git a/docs/conf.py b/docs/conf.py index 261fd0f00a7..25b890aa3d1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -202,6 +202,10 @@ "exclude-members": ",".join(_exclude_members), } +# Napoleon configuration to avoid duplication with autodoc for dataclass fields +# Use ivar (instance variable) style for documenting attributes +napoleon_use_ivar = True + # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for 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 95582e1601b..28237f09c4b 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 @@ -38,11 +38,6 @@ class Exemplar: 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] time_unix_nano: int diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement.py index 56619a83a1a..a73d6001a1a 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement.py @@ -25,7 +25,7 @@ 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`. @@ -33,11 +33,6 @@ class Measurement: 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 instrument: Instrument