aruraghuwanshi opened a new pull request, #19114:
URL: https://github.com/apache/druid/pull/19114

   Add supervisor/count metric for health and state monitoring
   
   Previously, supervisor health was only exposed via the REST API (`GET 
/druid/indexer/v1/supervisor/{id}/health`) and the `sys.supervisors` SQL table. 
There was no way to scrape supervisor health/state from Prometheus, StatsD, or 
other metric emitters for monitoring and alerting.
   
   This PR adds `SupervisorStatsMonitor`, which emits a `supervisor/count` 
gauge metric per supervisor. Each active supervisor contributes a value of 1, 
tagged with `supervisorId`, `type`, and `state` (RUNNING, SUSPENDED, 
UNHEALTHY_SUPERVISOR, UNHEALTHY_TASKS, etc.). Users can aggregate by state for 
dashboards and alerts (e.g. `sum(supervisor_count{state=~"UNHEALTHY_.*"})`).
   
   ### Description
   
   #### Design
   
   - **Pattern:** Mirrors `TaskCountStatsMonitor` / `TaskCountStatsProvider`: a 
provider interface in `server/`, implemented by `SupervisorManager` in 
`indexing-service/`, consumed by an Overlord-only monitor.
   - **Metric:** `supervisor/count` — gauge, value 1 per supervisor; 
dimensions: `supervisorId`, `type`, `state`.
   - **State source:** Uses `getState().getBasicState()` (7 values) instead of 
detailed states to avoid high cardinality.
   - **Opt-in:** Users add `SupervisorStatsMonitor` to 
`druid.monitoring.monitors`; no behavioral change without it.
   - **Cost:** Only uses `getState()` and spec metadata (cheap reads); no 
`getStatus()` calls on the monitor interval.
   
   #### Release note
   
   Adds a new `supervisor/count` metric when `SupervisorStatsMonitor` is 
enabled in `druid.monitoring.monitors`. The metric reports each supervisor’s 
state (RUNNING, SUSPENDED, UNHEALTHY_SUPERVISOR, etc.) for Prometheus, StatsD, 
and other metric systems.
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `SupervisorStatsProvider` (new interface)
    * `SupervisorStatsProvider.SupervisorStats` (new inner class)
    * `SupervisorStatsMonitor` (new)
    * `SupervisorManager` (implements `SupervisorStatsProvider`)
   
   <hr>
   
   This PR has:
   
   - [x] been self-reviewed.
   - [x] added documentation for new or modified features or behaviors.
   - [x] a release note entry in the PR description.
   - [x] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in 
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to