feat: allow using prometheus-client crate with PrometheusClientLayer#3134
Merged
Xuanwo merged 18 commits intoapache:mainfrom Sep 19, 2023
Merged
feat: allow using prometheus-client crate with PrometheusClientLayer#3134Xuanwo merged 18 commits intoapache:mainfrom
prometheus-client crate with PrometheusClientLayer#3134Xuanwo merged 18 commits intoapache:mainfrom
Conversation
Member
|
I would add a new layer called |
Contributor
Author
|
@Xuanwo you're right, what a pain. I've refactored to another PrometheusClientLayer, PTAL |
prometheus-client crate with PrometheusLayerprometheus-client crate with PrometheusClientLayer
Xuanwo
reviewed
Sep 19, 2023
Member
|
The only thing left is to make our CI happy. |
Young-Flash
pushed a commit
to Young-Flash/opendal
that referenced
this pull request
Sep 19, 2023
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-rscrate, but databend usesprometheus-clientfrom the prometheus official.This PR addes a feature option
use-prometheus-clientto allow switching toprometheus-clientwith the PrometheusLayer. Whenuse-prometheus-clientis enabled, we can pass aprometheus_client::registry::Registryto 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?