Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebdc101

Browse files
authored
Add more documentation (open-telemetry#2641)
Fixes open-telemetry#2129
1 parent 24ac96e commit ebdc101

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ def __init__(
9898

9999

100100
class Synchronous(Instrument):
101-
pass
101+
"""Base class for all synchronous instruments"""
102102

103103

104104
class Asynchronous(Instrument):
105+
"""Base class for all asynchronous instruments"""
106+
105107
@abstractmethod
106108
def __init__(
107109
self,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555

5656

5757
class Meter(APIMeter):
58+
"""See `opentelemetry._metrics.Meter`."""
59+
5860
def __init__(
5961
self,
6062
instrumentation_scope: InstrumentationScope,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535

3636

3737
class MetricExportResult(Enum):
38+
"""Result of exporting a metric
39+
40+
Can be any of the following values:"""
41+
3842
SUCCESS = 0
3943
FAILURE = 1
4044

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
@dataclass(frozen=True)
2525
class Measurement:
26+
"""
27+
Represents a data point reported via the metrics API to the SDK.
28+
"""
29+
2630
value: Union[int, float]
2731
instrument: "_Instrument"
2832
attributes: Attributes = None

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@
2323

2424

2525
class AggregationTemporality(IntEnum):
26+
"""
27+
The temporality to use when aggregating data.
28+
29+
Can be one of the following values:
30+
"""
31+
2632
UNSPECIFIED = 0
2733
DELTA = 1
2834
CUMULATIVE = 2
2935

3036

3137
@dataclass(frozen=True)
3238
class Sum:
39+
"""Represents the type of a scalar metric that is calculated as a sum of
40+
all reported measurements over a time interval."""
41+
3342
aggregation_temporality: AggregationTemporality
3443
is_monotonic: bool
3544
start_time_unix_nano: int
@@ -39,12 +48,19 @@ class Sum:
3948

4049
@dataclass(frozen=True)
4150
class Gauge:
51+
"""Represents the type of a scalar metric that always exports the current
52+
value for every data point. It should be used for an unknown
53+
aggregation."""
54+
4255
time_unix_nano: int
4356
value: Union[int, float]
4457

4558

4659
@dataclass(frozen=True)
4760
class Histogram:
61+
"""Represents the type of a metric that is calculated by aggregating as a
62+
histogram of all reported measurements over a time interval."""
63+
4864
aggregation_temporality: AggregationTemporality
4965
bucket_counts: Sequence[int]
5066
explicit_bounds: Sequence[float]

0 commit comments

Comments
 (0)