prefix all the metrics by meilisearch_

This commit is contained in:
Tamo 2023-05-25 17:41:53 +02:00
parent c433bdd1cd
commit 35d5556f1f
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
4 changed files with 51 additions and 79 deletions

View File

@ -24,7 +24,7 @@
"editable": true, "editable": true,
"fiscalYearStartMonth": 0, "fiscalYearStartMonth": 0,
"graphTooltip": 0, "graphTooltip": 0,
"id": 4, "id": 2,
"links": [], "links": [],
"liveNow": false, "liveNow": false,
"panels": [ "panels": [
@ -59,20 +59,17 @@
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
"mode": "continuous-YlBl" "mode": "continuous-GrYlRd"
}, },
"decimals": 0, "decimals": 0,
"mappings": [], "mappings": [],
"min": 0,
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ {
"color": "green", "color": "green",
"value": null "value": null
},
{
"color": "red",
"value": 80
} }
] ]
}, },
@ -89,6 +86,9 @@
"id": 2, "id": 2,
"interval": "5s", "interval": "5s",
"options": { "options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto", "orientation": "auto",
"reduceOptions": { "reduceOptions": {
"calcs": [ "calcs": [
@ -97,9 +97,7 @@
"fields": "", "fields": "",
"values": false "values": false
}, },
"showThresholdLabels": false, "textMode": "auto"
"showThresholdMarkers": true,
"text": {}
}, },
"pluginVersion": "9.5.2", "pluginVersion": "9.5.2",
"targets": [ "targets": [
@ -117,7 +115,7 @@
} }
], ],
"title": "Database Size", "title": "Database Size",
"type": "gauge" "type": "stat"
}, },
{ {
"datasource": { "datasource": {
@ -243,7 +241,8 @@
}, },
{ {
"datasource": { "datasource": {
"type": "prometheus" "type": "prometheus",
"uid": "c4085c47-f6d3-45dd-b761-6809055bb749"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -295,7 +294,7 @@
}, },
"editorMode": "builder", "editorMode": "builder",
"exemplar": true, "exemplar": true,
"expr": "round(increase(http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[1h]))", "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[1h]))",
"interval": "", "interval": "",
"legendFormat": "", "legendFormat": "",
"range": true, "range": true,
@ -307,7 +306,8 @@
}, },
{ {
"datasource": { "datasource": {
"type": "prometheus" "type": "prometheus",
"uid": "c4085c47-f6d3-45dd-b761-6809055bb749"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -355,7 +355,7 @@
}, },
"editorMode": "builder", "editorMode": "builder",
"exemplar": true, "exemplar": true,
"expr": "round(increase(http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[24h]))", "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[24h]))",
"interval": "", "interval": "",
"legendFormat": "", "legendFormat": "",
"range": true, "range": true,
@ -367,7 +367,8 @@
}, },
{ {
"datasource": { "datasource": {
"type": "prometheus" "type": "prometheus",
"uid": "c4085c47-f6d3-45dd-b761-6809055bb749"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -415,7 +416,7 @@
}, },
"editorMode": "builder", "editorMode": "builder",
"exemplar": true, "exemplar": true,
"expr": "round(increase(http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[30d]))", "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[30d]))",
"interval": "", "interval": "",
"legendFormat": "", "legendFormat": "",
"range": true, "range": true,
@ -427,7 +428,8 @@
}, },
{ {
"datasource": { "datasource": {
"type": "prometheus" "type": "prometheus",
"uid": "c4085c47-f6d3-45dd-b761-6809055bb749"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -509,7 +511,7 @@
}, },
"editorMode": "builder", "editorMode": "builder",
"exemplar": true, "exemplar": true,
"expr": "rate(http_requests_total{instance=\"$instance\", job=\"meilisearch\"}[5m])", "expr": "rate(meilisearch_http_requests_total{instance=\"$instance\", job=\"meilisearch\"}[5m])",
"interval": "", "interval": "",
"legendFormat": "{{method}} {{path}}", "legendFormat": "{{method}} {{path}}",
"range": true, "range": true,
@ -643,7 +645,7 @@
"overrides": [] "overrides": []
}, },
"gridPos": { "gridPos": {
"h": 12, "h": 11,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 18 "y": 18
@ -664,9 +666,9 @@
"exponent": 0.5, "exponent": 0.5,
"fill": "#b4ff00", "fill": "#b4ff00",
"mode": "scheme", "mode": "scheme",
"reverse": false, "reverse": true,
"scale": "exponential", "scale": "exponential",
"scheme": "Blues", "scheme": "RdYlBu",
"steps": 128 "steps": 128
}, },
"exemplars": { "exemplars": {
@ -688,7 +690,7 @@
}, },
"yAxis": { "yAxis": {
"axisPlacement": "left", "axisPlacement": "left",
"decimals": 2, "decimals": 0,
"reverse": false, "reverse": false,
"unit": "s" "unit": "s"
} }
@ -730,10 +732,7 @@
"yBucketNumber": 10 "yBucketNumber": 10
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "bb3298a4-9acf-4da1-b86a-813f29f50888"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -785,38 +784,13 @@
}, },
"unit": "none" "unit": "none"
}, },
"overrides": [ "overrides": []
{
"__systemRef": "hideSeriesFrom",
"matcher": {
"id": "byNames",
"options": {
"mode": "exclude",
"names": [
"succeeded "
],
"prefix": "All except:",
"readOnly": true
}
},
"properties": [
{
"id": "custom.hideFrom",
"value": {
"legend": false,
"tooltip": false,
"viz": true
}
}
]
}
]
}, },
"gridPos": { "gridPos": {
"h": 11, "h": 11,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 30 "y": 29
}, },
"id": 23, "id": 23,
"interval": "5s", "interval": "5s",
@ -840,7 +814,7 @@
}, },
"editorMode": "builder", "editorMode": "builder",
"exemplar": true, "exemplar": true,
"expr": "nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"statuses\"}", "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"statuses\"}",
"interval": "", "interval": "",
"legendFormat": "{{value}} ", "legendFormat": "{{value}} ",
"range": true, "range": true,
@ -851,10 +825,7 @@
"type": "timeseries" "type": "timeseries"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "bb3298a4-9acf-4da1-b86a-813f29f50888"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -912,7 +883,7 @@
"h": 11, "h": 11,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 30 "y": 29
}, },
"id": 24, "id": 24,
"interval": "5s", "interval": "5s",
@ -936,7 +907,7 @@
}, },
"editorMode": "builder", "editorMode": "builder",
"exemplar": true, "exemplar": true,
"expr": "nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"types\"}", "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"types\"}",
"interval": "", "interval": "",
"legendFormat": "{{value}} ", "legendFormat": "{{value}} ",
"range": true, "range": true,
@ -947,10 +918,7 @@
"type": "timeseries" "type": "timeseries"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "bb3298a4-9acf-4da1-b86a-813f29f50888"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -1008,7 +976,7 @@
"h": 11, "h": 11,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 41 "y": 40
}, },
"id": 25, "id": 25,
"interval": "5s", "interval": "5s",
@ -1032,7 +1000,7 @@
}, },
"editorMode": "builder", "editorMode": "builder",
"exemplar": true, "exemplar": true,
"expr": "nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"indexes\"}", "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"indexes\"}",
"interval": "", "interval": "",
"legendFormat": "{{value}} ", "legendFormat": "{{value}} ",
"range": true, "range": true,
@ -1052,7 +1020,7 @@
"h": 1, "h": 1,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 52 "y": 51
}, },
"id": 12, "id": 12,
"panels": [], "panels": [],
@ -1130,7 +1098,7 @@
"h": 11, "h": 11,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 53 "y": 52
}, },
"id": 4, "id": 4,
"interval": "5s", "interval": "5s",
@ -1233,7 +1201,7 @@
"h": 11, "h": 11,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 53 "y": 52
}, },
"id": 5, "id": 5,
"interval": "5s", "interval": "5s",
@ -1355,6 +1323,6 @@
"timezone": "", "timezone": "",
"title": "Meilisearch", "title": "Meilisearch",
"uid": "7wcZ94dnz", "uid": "7wcZ94dnz",
"version": 6, "version": 3,
"weekStart": "" "weekStart": ""
} }

View File

@ -17,8 +17,8 @@ fn create_buckets() -> [f64; 29] {
lazy_static! { lazy_static! {
pub static ref HTTP_RESPONSE_TIME_CUSTOM_BUCKETS: [f64; 29] = create_buckets(); pub static ref HTTP_RESPONSE_TIME_CUSTOM_BUCKETS: [f64; 29] = create_buckets();
pub static ref HTTP_REQUESTS_TOTAL: IntCounterVec = register_int_counter_vec!( pub static ref MEILISEARCH_HTTP_REQUESTS_TOTAL: IntCounterVec = register_int_counter_vec!(
opts!("http_requests_total", "HTTP requests total"), opts!("meilisearch_http_requests_total", "Meilisearch HTTP requests total"),
&["method", "path"] &["method", "path"]
) )
.expect("Can't create a metric"); .expect("Can't create a metric");
@ -33,14 +33,16 @@ lazy_static! {
&["index"] &["index"]
) )
.expect("Can't create a metric"); .expect("Can't create a metric");
pub static ref HTTP_RESPONSE_TIME_SECONDS: HistogramVec = register_histogram_vec!( pub static ref MEILISEARCH_HTTP_RESPONSE_TIME_SECONDS: HistogramVec = register_histogram_vec!(
"http_response_time_seconds", "http_response_time_seconds",
"HTTP response times", "HTTP response times",
&["method", "path"], &["method", "path"],
HTTP_RESPONSE_TIME_CUSTOM_BUCKETS.to_vec() HTTP_RESPONSE_TIME_CUSTOM_BUCKETS.to_vec()
) )
.expect("Can't create a metric"); .expect("Can't create a metric");
pub static ref NB_TASKS: IntGaugeVec = pub static ref MEILISEARCH_NB_TASKS: IntGaugeVec = register_int_gauge_vec!(
register_int_gauge_vec!(opts!("nb_tasks", "Number of tasks"), &["kind", "value"]) opts!("meilisearch_nb_tasks", "Meilisearch Number of tasks"),
.expect("Can't create a metric"); &["kind", "value"]
)
.expect("Can't create a metric");
} }

View File

@ -52,11 +52,11 @@ where
if is_registered_resource { if is_registered_resource {
let request_method = req.method().to_string(); let request_method = req.method().to_string();
histogram_timer = Some( histogram_timer = Some(
crate::metrics::HTTP_RESPONSE_TIME_SECONDS crate::metrics::MEILISEARCH_HTTP_RESPONSE_TIME_SECONDS
.with_label_values(&[&request_method, request_path]) .with_label_values(&[&request_method, request_path])
.start_timer(), .start_timer(),
); );
crate::metrics::HTTP_REQUESTS_TOTAL crate::metrics::MEILISEARCH_HTTP_REQUESTS_TOTAL
.with_label_values(&[&request_method, request_path]) .with_label_values(&[&request_method, request_path])
.inc(); .inc();
} }

View File

@ -41,7 +41,9 @@ pub async fn get_metrics(
for (kind, value) in index_scheduler.get_stats()? { for (kind, value) in index_scheduler.get_stats()? {
for (value, count) in value { for (value, count) in value {
crate::metrics::NB_TASKS.with_label_values(&[&kind, &value]).set(count as i64); crate::metrics::MEILISEARCH_NB_TASKS
.with_label_values(&[&kind, &value])
.set(count as i64);
} }
} }