Crates.io | vise-exporter |
lib.rs | vise-exporter |
version | |
source | src |
created_at | 2024-07-05 07:14:39.375173+00 |
updated_at | 2025-04-14 12:16:26.320809+00 |
description | Prometheus exporter for metrics defined using `vise` |
homepage | |
repository | https://github.com/matter-labs/vise |
max_upload_size | |
id | 1292426 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
vise
This crate provides a simple Prometheus metrics exporter for metrics defined
using vise
. It is based on the hyper
library and supports both pull-based
and push-based communication with Prometheus.
Add this to your Crate.toml:
[dependencies]
vise-exporter = "0.3.0"
An exporter can be initialized from a metrics Registry
:
use tokio::sync::watch;
use vise_exporter::MetricsExporter;
async fn my_app() {
let (shutdown_sender, mut shutdown_receiver) = watch::channel(());
let exporter = MetricsExporter::default()
.with_graceful_shutdown(async move {
shutdown_receiver.changed().await.ok();
});
let bind_address = "0.0.0.0:3312".parse().unwrap();
tokio::spawn(exporter.start(bind_address));
// Then, once the app is shutting down:
shutdown_sender.send_replace(());
}
See crate docs for more examples.
Distributed under the terms of either
at your option.