Add support to include the broker healthCheck status in the broker metrics.
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Motivation
Broker metrics don't have anything to indicate health of the broker (to indicate if broker is active). In Prometheus broker metrics which are used for monitoring, it will be useful if metrics also show the broker health. Prometheus can automatically scrape the broker state and can be used for monitoring purposes. So, add support to include the broker active status in the broker metrics.
Ex:
URL: http://localhost:8080/metrics
:
1 shows broker is active, 0 is inactive, -1 unknown
pulsar_health 1
### Solution
Allow periodic task to capture broker's health state and report to metrics, it should be controlled by config and by default it will be disabled.
### Alternatives
_No response_
### Anything else?
_No response_
### Are you willing to submit a PR?
- [X] I'm willing to submit a PR!
Contributor guide
Research direction
Start at the broker metrics endpoint shown in the issue (/metrics) and locate where broker health state and existing metrics are produced. Trace the periodic task and configuration needed to expose a pulsar_health metric, then verify the documented values and that the feature is disabled by default with appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100