Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Actually fix lint
  • Loading branch information
srikanthccv committed Mar 28, 2024
commit 4b46293012532d2e864dbc5b3ab20febbf69f6c9
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def create_histogram(
description: A description for this instrument and what it measures.
"""

def create_gauge(
def create_gauge( # type: ignore
self,
name: str,
unit: str = "",
Expand All @@ -401,9 +401,7 @@ def create_gauge(
example, ``By`` for bytes. UCUM units are recommended.
description: A description for this instrument and what it measures.
"""
warnings.warn(
"create_gauge() is not implemented and will be a no-op"
)
warnings.warn("create_gauge() is not implemented and will be a no-op")

@abstractmethod
def create_observable_gauge(
Expand Down
49 changes: 37 additions & 12 deletions opentelemetry-api/tests/metrics/test_subclass_instantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@

class MeterProviderImplTest(MeterProvider):
def get_meter(
self, name: str, version: Optional[str] = None, schema_url: Optional[str] = None
self,
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
) -> Meter:
return super().get_meter(name, version, schema_url)

Expand Down Expand Up @@ -72,7 +75,9 @@ def test_meter_subclass_instantiation():


class SynchronousImplTest(Synchronous):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)


Expand All @@ -82,7 +87,9 @@ def test_synchronous_subclass_instantiation():


class AsynchronousImplTest(Asynchronous):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)


Expand All @@ -92,7 +99,9 @@ def test_asynchronous_subclass_instantiation():


class CounterImplTest(Counter):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)

def add(self, amount: int, **kwargs):
Expand All @@ -105,7 +114,9 @@ def test_counter_subclass_instantiation():


class UpDownCounterImplTest(UpDownCounter):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)

def add(self, amount: int, **kwargs):
Expand All @@ -118,7 +129,9 @@ def test_up_down_counter_subclass_instantiation():


class ObservableCounterImplTest(ObservableCounter):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)


Expand All @@ -128,7 +141,9 @@ def test_observable_counter_subclass_instantiation():


class HistogramImplTest(Histogram):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)

def record(self, amount: int, **kwargs):
Expand All @@ -141,7 +156,9 @@ def test_histogram_subclass_instantiation():


class GaugeImplTest(_Gauge):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)

def set(self, amount: int, **kwargs):
Expand All @@ -154,7 +171,9 @@ def test_gauge_subclass_instantiation():


class InstrumentImplTest(Instrument):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)


Expand All @@ -164,7 +183,9 @@ def test_instrument_subclass_instantiation():


class ObservableGaugeImplTest(ObservableGauge):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)


Expand All @@ -174,10 +195,14 @@ def test_observable_gauge_subclass_instantiation():


class ObservableUpDownCounterImplTest(ObservableUpDownCounter):
def __init__(self, name: str, unit: str = "", description: str = "") -> None:
def __init__(
self, name: str, unit: str = "", description: str = ""
) -> None:
super().__init__(name, unit, description)


def test_observable_up_down_counter_subclass_instantiation():
observable_up_down_counter = ObservableUpDownCounterImplTest("subclass_test")
observable_up_down_counter = ObservableUpDownCounterImplTest(
"subclass_test"
)
assert isinstance(observable_up_down_counter, ObservableUpDownCounter)