mirror of
https://github.com/chylex/Apache-Prometheus-Exporter.git
synced 2025-04-30 15:34:05 +02:00
24 lines
641 B
Rust
24 lines
641 B
Rust
use prometheus_client::metrics::counter::Counter;
|
|
use prometheus_client::metrics::family::Family;
|
|
use prometheus_client::registry::Registry;
|
|
|
|
#[derive(Clone)]
|
|
pub struct ApacheMetrics {
|
|
pub requests_total: Family<(&'static str, String), Counter>
|
|
}
|
|
|
|
impl ApacheMetrics {
|
|
pub fn new() -> (Registry, ApacheMetrics) {
|
|
let mut registry = <Registry>::default();
|
|
|
|
let requests_total = Family::<(&'static str, String), Counter>::default();
|
|
registry.register("apache_requests", "Number of received requests", Box::new(requests_total.clone()));
|
|
|
|
let metrics = ApacheMetrics {
|
|
requests_total
|
|
};
|
|
|
|
return (registry, metrics);
|
|
}
|
|
}
|