pulsar
pulsar copied to clipboard
[improve][monitor]Add prometheusRawMetricsProvider support
Motivation
Currently, Pulsar Prometheus metric framework can generate new metrics from PrometheusRawMetricsProvider, and the current PrometheusMetricsProvider implementation doesn't support this interface, which leads to new created PrometheusMetricProvider instance can not integrate with the current metric system.
Modification
Pulsar prometheusMetricsProvider supports the following features.
- Support label
- Support PrometheusRawMetricsProvider interface.
This Pr just migrated from the BookKeeper Prometheus metrics provider.
Documentation
Check the box below or label this PR directly.
Need to update docs?
-
[x]
doc-required(Your PR needs to update docs and you will update later) -
[ ]
doc-not-needed(Please explain why) -
[ ]
doc(Your PR contains doc changes) -
[ ]
doc-complete(Docs have been already added)
Matching PR in the forked repository
PR in forked repository: https://github.com/hangc0276/pulsar/pull/4
@asafm @tjiuming Would you please help take a look? thanks.
@asafm @tjiuming Would you please help take a look? thanks.
Done @hangc0276
For future readers of this PR:
Why is this PR needed?
Pulsar uses Bookkeeper Client, which has metrics. The way to get those metrics is to implement the BK Metric library API, which Pulsar has already done through PrometheusMetricsProvider, PrometheusStatsLogger, etc.
The problem with that implementation was that the API itself supported having labels per metric, but the implementation ignored the labels provided to it.
This PR aims to fix and add support for the labels given to it via the API methods.
The impact is that now Pulsar /metrics endpoint, which exposes the Pulsar metrics in Prometheus format, will contain the Bookkeeper client metrics with labels (which were previously stripped).
For future readers of this PR:
Why is this PR needed? Pulsar uses Bookkeeper Client, which has metrics. The way to get those metrics is to implement the BK Metric library API, which Pulsar has already done through
PrometheusMetricsProvider,PrometheusStatsLogger, etc. The problem with that implementation was that the API itself supported having labels per metric, but the implementation ignored the labels provided to it.This PR aims to fix and add support for the labels given to it via the API methods. The impact is that now Pulsar
/metricsendpoint, which exposes the Pulsar metrics in Prometheus format, will contain the Bookkeeper client metrics with labels (which were previously stripped).
@asafm Thanks for your explanation. Another purpose of this Pr is to support plugin metrics integrate with Pulsar broker's metrics through the interface. https://github.com/apache/pulsar/blob/63d4cf20e7b9c9bd24d3fcd5ba7397f0d185ce57/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L904-L914
https://github.com/apache/pulsar/blob/63d4cf20e7b9c9bd24d3fcd5ba7397f0d185ce57/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L1673-L1682
@asafm @tjiuming Would you please help take a look? thanks.
Done @hangc0276
@asafm Thanks for your review, I addressed all the comments, please help take a look again, thanks a lot.
For future readers of this PR: Why is this PR needed? Pulsar uses Bookkeeper Client, which has metrics. The way to get those metrics is to implement the BK Metric library API, which Pulsar has already done through
PrometheusMetricsProvider,PrometheusStatsLogger, etc. The problem with that implementation was that the API itself supported having labels per metric, but the implementation ignored the labels provided to it. This PR aims to fix and add support for the labels given to it via the API methods. The impact is that now Pulsar/metricsendpoint, which exposes the Pulsar metrics in Prometheus format, will contain the Bookkeeper client metrics with labels (which were previously stripped).@asafm Thanks for your explanation. Another purpose of this Pr is to support plugin metrics integrate with Pulsar broker's metrics through the interface.
https://github.com/apache/pulsar/blob/63d4cf20e7b9c9bd24d3fcd5ba7397f0d185ce57/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L904-L914
https://github.com/apache/pulsar/blob/63d4cf20e7b9c9bd24d3fcd5ba7397f0d185ce57/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L1673-L1682
How do you provide such support in your PR - that I haven't figured out yet
BTW: Force push is not good - I lose all context - I can't see only the changes you've added
BTW: Force push is not good - I lose all context - I can't see only the changes you've added
Sorry, I just rebased the master, and it needs force push, otherwise, the push will fail
This PR changed the metric name for BK client, and it can only be released in the major version and needs to update the doc. /cc @Anonymitaet
The pr had no activity for 30 days, mark with Stale label.
I just wandering that why don't we use Prometheus lib, I think this implementation is hard to maintain
The pr had no activity for 30 days, mark with Stale label.