Open zwOvO opened 11 months ago
I'd really appreciate this change, just last week we were running into cases where we'd have loved to filter the metrics returned.
Do you think we would we be able to skip background work collecting metrics that were not matched by the query parameters? In some cases our metrics scraping can cause significant load on the brokers, perhaps this could be a mitigation?
Hey everyone, I would like to tackle this one if that's okay with the team.
I was able to come up with two potential approaches for implementing this feature:
This approach involves modifying each metric generation method to include filtering logic.
Pros:
Cons:
NamespaceStatsAggregator
, PrometheusMetricsProvider
, TransactionAggregator
, MetricsProviders
etc.)This approach involves creating a new FilteringTextOutputStream that extends SimpleTextOutputStream and incorporates the filtering logic.
Pros:
Cons:
URL Parameter:
/metrics?m=jvm_.*
Filter Format:
Having suggested both the approaches, I am leaning towards approach#1, as it more of a long-term solution to metric filtering problem, just not when output stream is involved.
Would appreciate feedback on this. Thanks! CC: @zwOvO
Search before asking
Motivation
The motivation for enhancing broker metrics to support URL parameter filtering in Pulsar is to provide users with a more flexible and convenient way to retrieve specific metrics. By allowing filtering through URL parameters, users can easily specify the metrics they are interested in, making it easier to monitor and analyze the performance of the Pulsar broker. This enhancement would improve the usability and accessibility of the metrics system, ultimately leading to a better user experience for Pulsar users.
Solution
for example:
Alternatives
No response
Anything else?
Currently, the broker metrics should be enhanced to allow filtering by URL parameters. This enhancement will enable users to filter metrics using URL parameters $ curl --location --request GET 'http://127.0.0.1:8080/metrics' 2>/dev/null|wc -l 100000
$ curl --location --request GET 'http://127.0.0.1:8080/metrics' 2>/dev/null|grep 'jvm_'|wc -l 20
Are you willing to submit a PR?