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

Skip to content

Add more documentation #2641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ def __init__(


class Synchronous(Instrument):
pass
"""Base class for all synchronous instruments"""


class Asynchronous(Instrument):
"""Base class for all asynchronous instruments"""

@abstractmethod
def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@


class Meter(APIMeter):
"""See `opentelemetry._metrics.Meter`."""

def __init__(
self,
instrumentation_scope: InstrumentationScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@


class MetricExportResult(Enum):
"""Result of exporting a metric

Can be any of the following values:"""

SUCCESS = 0
FAILURE = 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

@dataclass(frozen=True)
class Measurement:
"""
Represents a data point reported via the metrics API to the SDK.
"""

value: Union[int, float]
instrument: "_Instrument"
attributes: Attributes = None
16 changes: 16 additions & 0 deletions opentelemetry-sdk/src/opentelemetry/sdk/_metrics/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@


class AggregationTemporality(IntEnum):
"""
The temporality to use when aggregating data.

Can be one of the following values:
"""

UNSPECIFIED = 0
DELTA = 1
CUMULATIVE = 2


@dataclass(frozen=True)
class Sum:
"""Represents the type of a scalar metric that is calculated as a sum of
all reported measurements over a time interval."""

aggregation_temporality: AggregationTemporality
is_monotonic: bool
start_time_unix_nano: int
Expand All @@ -39,12 +48,19 @@ class Sum:

@dataclass(frozen=True)
class Gauge:
"""Represents the type of a scalar metric that always exports the current
value for every data point. It should be used for an unknown
aggregation."""

time_unix_nano: int
value: Union[int, float]


@dataclass(frozen=True)
class Histogram:
"""Represents the type of a metric that is calculated by aggregating as a
histogram of all reported measurements over a time interval."""

aggregation_temporality: AggregationTemporality
bucket_counts: Sequence[int]
explicit_bounds: Sequence[float]
Expand Down