mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[metrics] Remove unused unit field from cython classes (#14497)
This commit is contained in:
parent
dec3aa3453
commit
8e139046b9
2 changed files with 12 additions and 24 deletions
|
@ -70,20 +70,18 @@ cdef class Gauge(Metric):
|
|||
>>> gauge = Gauge(
|
||||
"ray.worker.metric",
|
||||
"description",
|
||||
"unit",
|
||||
["tagk1", "tagk2"]).
|
||||
value = 5
|
||||
key1= "key1"
|
||||
key2 = "key2"
|
||||
gauge.record(value, {"tagk1": key1, "tagk2": key2})
|
||||
"""
|
||||
def __init__(self, name, description, unit, tag_keys):
|
||||
def __init__(self, name, description, tag_keys):
|
||||
"""Create a gauge metric
|
||||
|
||||
Args:
|
||||
name (string): metric name.
|
||||
description (string): description of this metric.
|
||||
unit (string): measure unit of this metric.
|
||||
tag_keys (list): a list of tay keys in string format.
|
||||
"""
|
||||
super().__init__(tag_keys)
|
||||
|
@ -92,7 +90,7 @@ cdef class Gauge(Metric):
|
|||
new CGauge(
|
||||
name.encode("ascii"),
|
||||
description.encode("ascii"),
|
||||
unit.encode("ascii"),
|
||||
b"", # Unit, unused.
|
||||
self.c_tag_keys
|
||||
)
|
||||
)
|
||||
|
@ -106,7 +104,6 @@ cdef class Count(Metric):
|
|||
>>> count = Count(
|
||||
"ray.worker.metric",
|
||||
"description",
|
||||
"unit",
|
||||
["tagk1", "tagk2"]).
|
||||
value = 5
|
||||
key1= "key1"
|
||||
|
@ -116,13 +113,12 @@ cdef class Count(Metric):
|
|||
|
||||
Count: The count of the number of metric points.
|
||||
"""
|
||||
def __init__(self, name, description, unit, tag_keys):
|
||||
def __init__(self, name, description, tag_keys):
|
||||
"""Create a count metric
|
||||
|
||||
Args:
|
||||
name (string): metric name.
|
||||
description (string): description of this metric.
|
||||
unit (string): measure unit of this metric.
|
||||
tag_keys (list): a list of tay keys in string format.
|
||||
"""
|
||||
super().__init__(tag_keys)
|
||||
|
@ -131,7 +127,7 @@ cdef class Count(Metric):
|
|||
new CCount(
|
||||
name.encode("ascii"),
|
||||
description.encode("ascii"),
|
||||
unit.encode("ascii"),
|
||||
b"", # Unit, unused.
|
||||
self.c_tag_keys
|
||||
)
|
||||
)
|
||||
|
@ -145,7 +141,6 @@ cdef class Sum(Metric):
|
|||
>>> metric_sum = Sum(
|
||||
"ray.worker.metric",
|
||||
"description",
|
||||
"unit",
|
||||
["tagk1", "tagk2"]).
|
||||
value = 5
|
||||
key1= "key1"
|
||||
|
@ -155,13 +150,12 @@ cdef class Sum(Metric):
|
|||
|
||||
Sum: A sum up of the metric points.
|
||||
"""
|
||||
def __init__(self, name, description, unit, tag_keys):
|
||||
def __init__(self, name, description, tag_keys):
|
||||
"""Create a sum metric
|
||||
|
||||
Args:
|
||||
name (string): metric name.
|
||||
description (string): description of this metric.
|
||||
unit (string): measure unit of this metric.
|
||||
tag_keys (list): a list of tay keys in string format.
|
||||
"""
|
||||
|
||||
|
@ -171,7 +165,7 @@ cdef class Sum(Metric):
|
|||
new CSum(
|
||||
name.encode("ascii"),
|
||||
description.encode("ascii"),
|
||||
unit.encode("ascii"),
|
||||
b"", # Unit, unused.
|
||||
self.c_tag_keys
|
||||
)
|
||||
)
|
||||
|
@ -184,8 +178,7 @@ cdef class Histogram(Metric):
|
|||
|
||||
>>> histogram = Histogram(
|
||||
"ray.worker.histogram1",
|
||||
"desciprtion",
|
||||
"unit",
|
||||
"description",
|
||||
[1.0, 2.0], # boundaries.
|
||||
["tagk1"])
|
||||
value = 5
|
||||
|
@ -195,13 +188,12 @@ cdef class Histogram(Metric):
|
|||
|
||||
Histogram: Histogram distribution of metric points.
|
||||
"""
|
||||
def __init__(self, name, description, unit, boundaries, tag_keys):
|
||||
def __init__(self, name, description, boundaries, tag_keys):
|
||||
"""Create a sum metric
|
||||
|
||||
Args:
|
||||
name (string): metric name.
|
||||
description (string): description of this metric.
|
||||
unit (string): measure unit of this metric.
|
||||
boundaries (list): a double type list boundaries of histogram.
|
||||
tag_keys (list): a list of tay key in string format.
|
||||
"""
|
||||
|
@ -216,7 +208,7 @@ cdef class Histogram(Metric):
|
|||
new CHistogram(
|
||||
name.encode("ascii"),
|
||||
description.encode("ascii"),
|
||||
unit.encode("ascii"),
|
||||
b"", # Unit, unused.
|
||||
c_boundaries,
|
||||
self.c_tag_keys
|
||||
)
|
||||
|
|
|
@ -27,9 +27,6 @@ class Metric:
|
|||
"Please provide a metric name.")
|
||||
self._name = name
|
||||
self._description = description
|
||||
# We don't specify unit because it won't be
|
||||
# exported to Prometheus anyway.
|
||||
self._unit = ""
|
||||
# The default tags key-value pair.
|
||||
self._default_tags = {}
|
||||
# Keys of tags.
|
||||
|
@ -144,7 +141,7 @@ class Count(Metric):
|
|||
description: str = "",
|
||||
tag_keys: Optional[Tuple[str]] = None):
|
||||
super().__init__(name, description, tag_keys)
|
||||
self._metric = CythonCount(self._name, self._description, self._unit,
|
||||
self._metric = CythonCount(self._name, self._description,
|
||||
self._tag_keys)
|
||||
|
||||
def __reduce__(self):
|
||||
|
@ -179,8 +176,7 @@ class Histogram(Metric):
|
|||
"Histogram class. e.g., Histogram(boundaries=[1.0, 2.0])")
|
||||
self.boundaries = boundaries
|
||||
self._metric = CythonHistogram(self._name, self._description,
|
||||
self._unit, self.boundaries,
|
||||
self._tag_keys)
|
||||
self.boundaries, self._tag_keys)
|
||||
|
||||
def __reduce__(self):
|
||||
deserializer = Histogram
|
||||
|
@ -212,7 +208,7 @@ class Gauge(Metric):
|
|||
description: str = "",
|
||||
tag_keys: Optional[Tuple[str]] = None):
|
||||
super().__init__(name, description, tag_keys)
|
||||
self._metric = CythonGauge(self._name, self._description, self._unit,
|
||||
self._metric = CythonGauge(self._name, self._description,
|
||||
self._tag_keys)
|
||||
|
||||
def __reduce__(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue