-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow using prometheus-client
crate with PrometheusClientLayer
#3134
Conversation
I would add a new layer called |
@Xuanwo you're right, what a pain. I've refactored to another PrometheusClientLayer, PTAL |
prometheus-client
crate with PrometheusLayerprometheus-client
crate with PrometheusClientLayer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, let's go!
The only thing left is to make our CI happy. |
apache#3134) * refactor prometheus layer * add prometheus-client to deps * chore: simplify imports * refactor the metrics into a trait * feat: add implementation with prometheus-client * fix: allow using different trait * cargo fmt * refactor: add a seperate layer * fix: docs * fix typo * fix: cargo fmt * add a prefix * use structed labels * use labels in array * remove the unused metrics * rename stats to metrics * record request duration in wrapper * fix fmt
I'm currently working on switching to prometheus from metrics-rs in databend at databendlabs/databend#12787 , but unfortunately the PrometheusLayer in opendal uses the
tikv/prometheus-rs
crate, but databend usesprometheus-client
from the prometheus official.This PR addes a feature option
use-prometheus-client
to allow switching toprometheus-client
with the PrometheusLayer. Whenuse-prometheus-client
is enabled, we can pass aprometheus_client::registry::Registry
to aPrometheusLayer
.To support both of the prometheus client, this PR also make a small refactor to collect the metrics writing logics into a trait
PrometheusLayerMetrics
.I believe the official prometheus may have longer term of support, maybe we can have a schedule to migrate to it while deprecate the older prometheus library's support?