apache / apache/pulsar

Add support to include the broker healthCheck status in the broker metrics.

Open
#20,146 1 comment 0 reactions 0 assignees View on GitHub
Stale type/enhancement
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.