https://github.com/paberr/metrics-prometheus-client
Creating compatibility between `metrics` and `prometheus_client`.
https://github.com/paberr/metrics-prometheus-client
Last synced: 9 months ago
JSON representation
Creating compatibility between `metrics` and `prometheus_client`.
- Host: GitHub
- URL: https://github.com/paberr/metrics-prometheus-client
- Owner: paberr
- License: apache-2.0
- Created: 2024-07-21T08:05:00.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-23T17:28:14.000Z (almost 2 years ago)
- Last Synced: 2025-02-28T17:10:33.190Z (over 1 year ago)
- Language: Rust
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# metrics-prometheus-client
Creating compatibility between `metrics` and `prometheus_client`.
## Usage
```rust
use metrics_prometheus_client::install;
use prometheus_client::{encoding::text::encode, registry::Registry};
let collector = install();
// Use `metrics` crate interfaces.
metrics::counter!("count", "whose" => "mine", "kind" => "owned").increment(1);
let mut registry = Registry::default();
registry.register_collector(Box::new(collector));
let mut report = String::new();
encode(&mut report, ®istry).unwrap();
assert_eq!(
report.trim(),
"# HELP count \n# TYPE count counter\ncount_total{whose=\"mine\",kind=\"owned\"} 1\n# EOF"
.trim(),
);
```