Skip to content

Creating compatibility between `metrics` and `prometheus_client`.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

paberr/metrics-prometheus-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metrics-prometheus-client

Creating compatibility between metrics and prometheus_client.

Usage

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, &registry).unwrap();

assert_eq!(
    report.trim(),
    "# HELP count \n# TYPE count counter\ncount_total{whose=\"mine\",kind=\"owned\"} 1\n# EOF"
        .trim(),
);

About

Creating compatibility between `metrics` and `prometheus_client`.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages