mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-14 00:41:35 +08:00
chore: should improve the prometheus metric naming (#2073)
By looking at name like `apisix_bandwidth` or `apisix_http_latency`, it is hard to guess their units. Also, it is not so clear for where does the overhead come from for `apisix_http_overhead` at the first glance.
This commit is contained in:
parent
cf882bda1e
commit
36bb0a8d3e
@ -69,6 +69,14 @@ function _M.init()
|
|||||||
|
|
||||||
clear_tab(metrics)
|
clear_tab(metrics)
|
||||||
|
|
||||||
|
-- Newly added metrics should follow the naming best pratices described in
|
||||||
|
-- https://prometheus.io/docs/practices/naming/#metric-names
|
||||||
|
-- For example,
|
||||||
|
-- 1. Add unit as the suffix
|
||||||
|
-- 2. Add `_total` as the suffix if the metric type is counter
|
||||||
|
-- 3. Use base unit
|
||||||
|
-- We keep the old metric names for the compatibility.
|
||||||
|
|
||||||
-- across all services
|
-- across all services
|
||||||
prometheus = base_prometheus.init("prometheus-metrics", "apisix_")
|
prometheus = base_prometheus.init("prometheus-metrics", "apisix_")
|
||||||
metrics.connections = prometheus:gauge("nginx_http_current_connections",
|
metrics.connections = prometheus:gauge("nginx_http_current_connections",
|
||||||
@ -93,11 +101,12 @@ function _M.init()
|
|||||||
{"code", "route", "service", "node"})
|
{"code", "route", "service", "node"})
|
||||||
|
|
||||||
metrics.latency = prometheus:histogram("http_latency",
|
metrics.latency = prometheus:histogram("http_latency",
|
||||||
"HTTP request latency per service in APISIX",
|
"HTTP request latency in milliseconds per service in APISIX",
|
||||||
{"type", "service", "node"}, DEFAULT_BUCKETS)
|
{"type", "service", "node"}, DEFAULT_BUCKETS)
|
||||||
|
|
||||||
metrics.overhead = prometheus:histogram("http_overhead",
|
metrics.overhead = prometheus:histogram("http_overhead",
|
||||||
"HTTP request overhead per service in APISIX",
|
"HTTP request overhead added by APISIX in milliseconds per service " ..
|
||||||
|
"in APISIX",
|
||||||
{"type", "service", "node"}, DEFAULT_BUCKETS)
|
{"type", "service", "node"}, DEFAULT_BUCKETS)
|
||||||
|
|
||||||
metrics.bandwidth = prometheus:counter("bandwidth",
|
metrics.bandwidth = prometheus:counter("bandwidth",
|
||||||
|
Loading…
Reference in New Issue
Block a user