[Stats] Metrics Export User Interface Part 1 (#9913)

* Metrics export port expose done.

* Support exposing metrics port + metrics agent service discovery through ray.nodes()

* Formatting.

* Added a doc.

* Linting.

* Change the location of metrics agent port.

* Addressed code review.

* Addressed code review.
This commit is contained in:
SangBin Cho
2020-08-06 16:16:29 -07:00
committed by GitHub
parent eace94d2dc
commit ec2f1a225e
26 changed files with 322 additions and 51 deletions
+1
View File
@@ -226,6 +226,7 @@ cdef extern from "ray/core_worker/core_worker.h" nogil:
(c_bool() nogil) kill_main
CCoreWorkerOptions()
(void() nogil) terminate_asyncio_thread
int metrics_agent_port
c_string serialized_job_config
cdef cppclass CCoreWorkerProcess "ray::CoreWorkerProcess":
+53 -1
View File
@@ -62,7 +62,20 @@ cdef class Metric:
cdef class Gauge(Metric):
"""Cython wrapper class of C++ `ray::stats::Gauge`.
Gauge: Keeps the last recorded value, drops everything before.
Gauge: Keeps the last recorded value, drops everything before.
Example:
>>> gauge = Gauge(
"ray.worker.metric",
"description",
"unit",
["tagk1", "tagk2"]).
value = 5
key1= "key1"
key2 = "key2"
s
gauge.record(value, {"tagk1": key1, "tagk2": key2})
"""
def __init__(self, name, description, unit, tag_keys):
"""Create a gauge metric
@@ -88,6 +101,19 @@ cdef class Gauge(Metric):
cdef class Count(Metric):
"""Cython wrapper class of C++ `ray::stats::Count`.
Example:
>>> count = Count(
"ray.worker.metric",
"description",
"unit",
["tagk1", "tagk2"]).
value = 5
key1= "key1"
key2 = "key2"
count.record(value, {"tagk1": key1, "tagk2": key2})
Count: The count of the number of metric points.
"""
def __init__(self, name, description, unit, tag_keys):
@@ -114,6 +140,19 @@ cdef class Count(Metric):
cdef class Sum(Metric):
"""Cython wrapper class of C++ `ray::stats::Sum`.
Example:
>>> metric_sum = Sum(
"ray.worker.metric",
"description",
"unit",
["tagk1", "tagk2"]).
value = 5
key1= "key1"
key2 = "key2"
metric_sum.record(value, {"tagk1": key1, "tagk2": key2})
Sum: A sum up of the metric points.
"""
def __init__(self, name, description, unit, tag_keys):
@@ -141,6 +180,19 @@ cdef class Sum(Metric):
cdef class Histogram(Metric):
"""Cython wrapper class of C++ `ray::stats::Histogram`.
Example:
>>> histogram = Histogram(
"ray.worker.histogram1",
"desciprtion",
"unit",
[1.0, 2.0], # boundaries.
["tagk1"])
value = 5
key1= "key1"
histogram.record(value, {"tagk1": key1})
Histogram: Histogram distribution of metric points.
"""
def __init__(self, name, description, unit, boundaries, tag_keys):