Skip to content

Commit

Permalink
Add Prometheus counter for SystemMonitor.last_time (#7785)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger authored Apr 19, 2023
1 parent 172f23d commit eb531b3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions distributed/http/scheduler/prometheus/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def collect(self) -> Iterator[GaugeMetricFamily | CounterMetricFamily]:
value=self.server.monitor._cumulative_gil_contention,
)

yield CounterMetricFamily(
self.build_name("last_time"),
"SystemMonitor last time",
value=self.server.monitor.last_time,
)

tasks = GaugeMetricFamily(
self.build_name("tasks"),
"Number of tasks known by scheduler",
Expand Down
1 change: 1 addition & 0 deletions distributed/http/scheduler/tests/test_scheduler_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async def test_prometheus(c, s, a, b):
"dask_scheduler_clients",
"dask_scheduler_desired_workers",
"dask_scheduler_workers",
"dask_scheduler_last_time",
"dask_scheduler_tasks",
"dask_scheduler_tasks_suspicious",
"dask_scheduler_tasks_forgotten",
Expand Down
2 changes: 2 additions & 0 deletions docs/source/prometheus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ dask_scheduler_gil_contention_total

dask_scheduler_workers
Number of workers known by scheduler
dask_scheduler_last_time_total
Cumulative SystemMonitor time
dask_scheduler_tasks
Number of tasks known by scheduler
dask_scheduler_tasks_suspicious_total
Expand Down

0 comments on commit eb531b3

Please sign in to comment.