2022-08-04 22:46:09 +08:00
|
|
|
use lazy_static::lazy_static;
|
2022-08-08 13:41:38 +08:00
|
|
|
use prometheus::{
|
|
|
|
opts, register_histogram_vec, register_int_counter_vec, register_int_gauge,
|
|
|
|
register_int_gauge_vec,
|
|
|
|
};
|
2022-08-04 22:46:09 +08:00
|
|
|
use prometheus::{HistogramVec, IntCounterVec, IntGauge, IntGaugeVec};
|
|
|
|
|
|
|
|
const HTTP_RESPONSE_TIME_CUSTOM_BUCKETS: &[f64; 14] = &[
|
|
|
|
0.0005, 0.0008, 0.00085, 0.0009, 0.00095, 0.001, 0.00105, 0.0011, 0.00115, 0.0012, 0.0015,
|
|
|
|
0.002, 0.003, 1.0,
|
|
|
|
];
|
|
|
|
|
|
|
|
lazy_static! {
|
|
|
|
pub static ref HTTP_REQUESTS_TOTAL: IntCounterVec = register_int_counter_vec!(
|
|
|
|
opts!("http_requests_total", "HTTP requests total"),
|
|
|
|
&["method", "path"]
|
|
|
|
)
|
|
|
|
.expect("Can't create a metric");
|
2022-08-23 23:09:27 +08:00
|
|
|
pub static ref MEILISEARCH_DB_SIZE_BYTES: IntGauge = register_int_gauge!(opts!(
|
|
|
|
"meilisearch_db_size_bytes",
|
|
|
|
"Meilisearch Db Size In Bytes"
|
2022-08-08 13:41:38 +08:00
|
|
|
))
|
2022-08-04 22:46:09 +08:00
|
|
|
.expect("Can't create a metric");
|
2022-08-23 23:17:02 +08:00
|
|
|
pub static ref MEILISEARCH_INDEX_COUNT: IntGauge =
|
|
|
|
register_int_gauge!(opts!("meilisearch_index_count", "Meilisearch Index Count"))
|
|
|
|
.expect("Can't create a metric");
|
2022-08-23 23:09:27 +08:00
|
|
|
pub static ref MEILISEARCH_INDEX_DOCS_COUNT: IntGaugeVec = register_int_gauge_vec!(
|
2022-08-23 23:17:02 +08:00
|
|
|
opts!(
|
|
|
|
"meilisearch_index_docs_count",
|
|
|
|
"Meilisearch Index Docs Count"
|
|
|
|
),
|
2022-08-04 22:46:09 +08:00
|
|
|
&["index"]
|
|
|
|
)
|
|
|
|
.expect("Can't create a metric");
|
|
|
|
pub static ref HTTP_RESPONSE_TIME_SECONDS: HistogramVec = register_histogram_vec!(
|
|
|
|
"http_response_time_seconds",
|
|
|
|
"HTTP response times",
|
|
|
|
&["method", "path"],
|
|
|
|
HTTP_RESPONSE_TIME_CUSTOM_BUCKETS.to_vec()
|
|
|
|
)
|
|
|
|
.expect("Can't create a metric");
|
2022-08-08 13:41:38 +08:00
|
|
|
}
|