[−][src]Crate open_metrics_client
Client library implementation of the Open Metrics specification. Allows developers to instrument applications and thus enables operators to monitor said applications with monitoring systems like Prometheus.
Examples
// Create registry and counter and register the latter with the former. let mut registry = Registry::default(); let counter = Counter::<AtomicU64>::new(); registry.register( "my_counter", "This is my counter", counter.clone(), ); // Record an observation by increasing the counter. counter.inc(); // Encode all metrics in the registry in the text format. let mut buffer = vec![]; encode(&mut buffer, ®istry).unwrap(); let expected = "# HELP my_counter This is my counter.\n".to_owned() + "# TYPE my_counter counter\n" + "my_counter_total 1\n" + "# EOF\n"; assert_eq!(expected, String::from_utf8(buffer).unwrap());
See examples directory for more.
Modules
encoding | Exposition format implementations. |
metrics | Metric type implementations. |
registry | Metric registry implementation. |