Skip to content

Commit faf8868

Browse files
author
Alex Boten
authored
[docs] SDK documentation fixes (#2620)
1 parent 3323ce2 commit faf8868

File tree

9 files changed

+64
-15
lines changed

9 files changed

+64
-15
lines changed

docs/api/metrics.instrument.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ opentelemetry._metrics.instrument
55
:members:
66
:private-members:
77
:undoc-members:
8-
:show-inheritance:
8+
:no-show-inheritance:

docs/conf.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,31 @@
142142
"examples/error_handler/error_handler_1",
143143
]
144144

145+
_exclude_members = [
146+
"_ProxyObservableUpDownCounter",
147+
"_ProxyHistogram",
148+
"_ProxyObservableGauge",
149+
"_ProxyInstrument",
150+
"_ProxyAsynchronousInstrument",
151+
"_ProxyCounter",
152+
"_ProxyUpDownCounter",
153+
"_ProxyObservableCounter",
154+
"_ProxyObservableGauge",
155+
"_abc_impl",
156+
"_Adding",
157+
"_Grouping",
158+
"_Monotonic",
159+
"_NonMonotonic",
160+
"Synchronous",
161+
"Asynchronous",
162+
]
163+
145164
autodoc_default_options = {
146165
"members": True,
147166
"undoc-members": True,
148167
"show-inheritance": True,
149168
"member-order": "bysource",
150-
"exclude-members": "_ProxyObservableUpDownCounter,_ProxyHistogram,_ProxyObservableGauge,_ProxyInstrument,_ProxyAsynchronousInstrument,_ProxyCounter,_ProxyUpDownCounter,_ProxyObservableCounter,_ProxyObservableGauge,_abc_impl",
169+
"exclude-members": ",".join(_exclude_members),
151170
}
152171

153172
# -- Options for HTML output -------------------------------------------------

docs/sdk/metrics.export.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
opentelemetry.sdk._metrics.export
2+
=================================
3+
4+
.. automodule:: opentelemetry.sdk._metrics.export
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/sdk/metrics.point.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
opentelemetry.sdk._metrics.point
2+
================================
3+
4+
.. automodule:: opentelemetry.sdk._metrics.point
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/sdk/metrics.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Submodules
1616
metrics.view
1717
metrics.aggregation
1818
metrics.metric_reader
19+
metrics.point
20+
metrics.export
1921

2022
.. automodule:: opentelemetry.sdk._metrics
2123
:members:

opentelemetry-api/src/opentelemetry/_metrics/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def cpu_time_callback(states_to_include: set[str]) -> Iterable[Iterable[Observat
331331

332332
@abstractmethod
333333
def create_histogram(self, name, unit="", description="") -> Histogram:
334-
"""Creates a `Histogram` instrument
334+
"""Creates a `opentelemetry._metrics.instrument.Histogram` instrument
335335
336336
Args:
337337
name: The name of the instrument to be created

opentelemetry-api/src/opentelemetry/_metrics/instrument.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343

4444

4545
class Instrument(ABC):
46+
"""Abstract class that serves as base for all instruments."""
47+
4648
@abstractmethod
4749
def __init__(self, name, unit="", description=""):
4850
pass
@@ -120,6 +122,8 @@ def add(self, amount, attributes=None):
120122

121123

122124
class NoOpCounter(Counter):
125+
"""No-op implementation of `Counter`."""
126+
123127
def __init__(self, name, unit="", description=""):
124128
super().__init__(name, unit=unit, description=description)
125129

@@ -145,6 +149,8 @@ def add(self, amount, attributes=None):
145149

146150

147151
class NoOpUpDownCounter(UpDownCounter):
152+
"""No-op implementation of `UpDownCounter`."""
153+
148154
def __init__(self, name, unit="", description=""):
149155
super().__init__(name, unit=unit, description=description)
150156

@@ -170,6 +176,8 @@ class ObservableCounter(_Monotonic, Asynchronous):
170176

171177

172178
class NoOpObservableCounter(ObservableCounter):
179+
"""No-op implementation of `ObservableCounter`."""
180+
173181
def __init__(self, name, callbacks=None, unit="", description=""):
174182
super().__init__(name, callbacks, unit=unit, description=description)
175183

@@ -193,6 +201,8 @@ class ObservableUpDownCounter(_NonMonotonic, Asynchronous):
193201

194202

195203
class NoOpObservableUpDownCounter(ObservableUpDownCounter):
204+
"""No-op implementation of `ObservableUpDownCounter`."""
205+
196206
def __init__(self, name, callbacks=None, unit="", description=""):
197207
super().__init__(name, callbacks, unit=unit, description=description)
198208

@@ -221,6 +231,8 @@ def record(self, amount, attributes=None):
221231

222232

223233
class NoOpHistogram(Histogram):
234+
"""No-op implementation of `Histogram`."""
235+
224236
def __init__(self, name, unit="", description=""):
225237
super().__init__(name, unit=unit, description=description)
226238

@@ -247,6 +259,8 @@ class ObservableGauge(_Grouping, Asynchronous):
247259

248260

249261
class NoOpObservableGauge(ObservableGauge):
262+
"""No-op implementation of `ObservableGauge`."""
263+
250264
def __init__(self, name, callbacks=None, unit="", description=""):
251265
super().__init__(name, callbacks, unit=unit, description=description)
252266

opentelemetry-sdk/src/opentelemetry/sdk/_metrics/aggregation.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ class DefaultAggregation(_AggregationFactory):
8282
This aggregation will create an actual aggregation depending on the
8383
instrument type, as specified next:
8484
85-
========================= ====================================
86-
Instrument Aggregation
87-
========================= ====================================
88-
`Counter` `SumAggregation`
89-
`UpDownCounter` `SumAggregation`
90-
`ObservableCounter` `SumAggregation`
91-
`ObservableUpDownCounter` `SumAggregation`
92-
`Histogram` `ExplicitBucketHistogramAggregation`
93-
`ObservableGauge` `LastValueAggregation`
94-
========================= ====================================
85+
============================================= ====================================
86+
Instrument Aggregation
87+
============================================= ====================================
88+
`Counter` `SumAggregation`
89+
`UpDownCounter` `SumAggregation`
90+
`ObservableCounter` `SumAggregation`
91+
`ObservableUpDownCounter` `SumAggregation`
92+
`opentelemetry._metrics.instrument.Histogram` `ExplicitBucketHistogramAggregation`
93+
`ObservableGauge` `LastValueAggregation`
94+
============================================= ====================================
9595
"""
9696

9797
def _create_aggregation(self, instrument: Instrument) -> _Aggregation:

opentelemetry-sdk/src/opentelemetry/sdk/_metrics/export/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def export(self, metrics: Sequence[Metric]) -> "MetricExportResult":
5555
"""Exports a batch of telemetry data.
5656
5757
Args:
58-
metrics: The list of `opentelemetry.sdk._metrics.data.MetricData` objects to be exported
58+
metrics: The list of `opentelemetry.sdk._metrics.point.Metric` objects to be exported
5959
6060
Returns:
6161
The result of the export
@@ -97,7 +97,7 @@ def shutdown(self) -> None:
9797

9898

9999
class InMemoryMetricReader(MetricReader):
100-
"""Implementation of :class:`MetricReader` that returns its metrics from :func:`metrics`.
100+
"""Implementation of `MetricReader` that returns its metrics from :func:`get_metrics`.
101101
102102
This is useful for e.g. unit tests.
103103
"""

0 commit comments

Comments
 (0)