Skip to content

Commit

Permalink
Fix name of SDK Gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Feb 5, 2024
1 parent 86f615c commit 7639544
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
5 changes: 5 additions & 0 deletions opentelemetry-api/src/opentelemetry/metrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
Histogram,
Instrument,
NoOpCounter,
)
from opentelemetry.metrics._internal.instrument import NoOpGauge as _NoOpGauge
from opentelemetry.metrics._internal.instrument import (
NoOpHistogram,
NoOpObservableCounter,
NoOpObservableGauge,
Expand All @@ -78,6 +81,7 @@
Asynchronous,
CallbackOptions,
_Gauge,
_NoOpGauge,
get_meter_provider,
get_meter,
Histogram,
Expand Down Expand Up @@ -108,6 +112,7 @@
"Meter",
"Counter",
"_Gauge",
"_NoOpGauge",
"NoOpCounter",
"UpDownCounter",
"NoOpUpDownCounter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def create_gauge(
unit: str = "",
description: str = "",
) -> Gauge:
"""Creates a `Gauge` instrument
"""Creates a ``Gauge`` instrument
Args:
name: The name of the instrument to be created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def set(


class NoOpGauge(Gauge):
"""No-op implementation of `Gauge`."""
"""No-op implementation of ``Gauge``."""

def __init__(
self,
Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

from opentelemetry.sdk.metrics._internal import Meter, MeterProvider
from opentelemetry.sdk.metrics._internal.exceptions import MetricsTimeoutError
from opentelemetry.sdk.metrics._internal.instrument import Counter
from opentelemetry.sdk.metrics._internal.instrument import Gauge as _Gauge
from opentelemetry.sdk.metrics._internal.instrument import (
Counter,
Gauge,
Histogram,
ObservableCounter,
ObservableGauge,
Expand All @@ -31,7 +31,7 @@
"MetricsTimeoutError",
"Counter",
"Histogram",
"Gauge",
"_Gauge",
"ObservableCounter",
"ObservableGauge",
"ObservableUpDownCounter",
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/tests/metrics/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ def test_import_init(self):
with self.assertNotRaises(Exception):
from opentelemetry.sdk.metrics import ( # noqa: F401
Counter,
Gauge,
Histogram,
Meter,
MeterProvider,
ObservableCounter,
ObservableGauge,
ObservableUpDownCounter,
UpDownCounter,
_Gauge,
)

def test_import_export(self):
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/tests/metrics/test_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
from opentelemetry.metrics._internal.instrument import CallbackOptions
from opentelemetry.sdk.metrics import (
Counter,
Gauge,
Histogram,
ObservableCounter,
ObservableGauge,
ObservableUpDownCounter,
UpDownCounter,
)
from opentelemetry.sdk.metrics import _Gauge as _SDKGauge
from opentelemetry.sdk.metrics._internal.instrument import (
_Counter,
_Gauge,
Expand Down Expand Up @@ -309,7 +309,7 @@ def test_set(self):
def test_disallow_direct_counter_creation(self):
with self.assertRaises(TypeError):
# pylint: disable=abstract-class-instantiated
Gauge("name", Mock(), Mock())
_SDKGauge("name", Mock(), Mock())


class TestObservableUpDownCounter(TestCase):
Expand Down
10 changes: 3 additions & 7 deletions opentelemetry-sdk/tests/metrics/test_metric_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
from unittest import TestCase
from unittest.mock import patch

from opentelemetry.sdk.metrics import (
Counter,
Gauge,
Histogram,
ObservableGauge,
)
from opentelemetry.sdk.metrics import Counter, Histogram, ObservableGauge
from opentelemetry.sdk.metrics import _Gauge as _SDKGauge
from opentelemetry.sdk.metrics._internal.instrument import (
_Counter,
_Gauge,
Expand Down Expand Up @@ -83,7 +79,7 @@ def test_configure_temporality(self):
preferred_temporality={
Histogram: AggregationTemporality.DELTA,
ObservableGauge: AggregationTemporality.DELTA,
Gauge: AggregationTemporality.DELTA,
_SDKGauge: AggregationTemporality.DELTA,
}
)

Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/tests/metrics/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
from opentelemetry.metrics import NoOpMeter
from opentelemetry.sdk.metrics import (
Counter,
Gauge,
Histogram,
Meter,
MeterProvider,
ObservableCounter,
ObservableGauge,
ObservableUpDownCounter,
UpDownCounter,
_Gauge,
)
from opentelemetry.sdk.metrics._internal import SynchronousMeasurementConsumer
from opentelemetry.sdk.metrics.export import (
Expand Down Expand Up @@ -448,7 +448,7 @@ def test_create_gauge(self):
"name", unit="unit", description="description"
)

self.assertIsInstance(gauge, Gauge)
self.assertIsInstance(gauge, _Gauge)
self.assertEqual(gauge.name, "name")

def test_create_observable_up_down_counter(self):
Expand Down

0 comments on commit 7639544

Please sign in to comment.