Commit 6b18cd9c authored by ale's avatar ale

Merge branch 'nginx-metrics' into 'master'

Stop exporing per-backend nginx metrics

See merge request !132
parents b1ea6f1e 4d875027
Pipeline #7682 failed with stages
in 10 minutes and 32 seconds
......@@ -16,6 +16,7 @@
apt:
name: "{{ packages }}"
state: present
default_release: "buster-backports"
vars:
packages:
- podman
......
# Define the exported metrics.
counter nginx_http_request_total
counter nginx_http_requests by host, vhost, method, code, backend
counter nginx_http_requests by host, vhost, method, code
counter nginx_http_requests_cache by host, vhost, cache_status
counter nginx_http_bytes by host, vhost, method, code, backend
counter nginx_http_bytes by host, vhost, method, code
counter nginx_http_bytes_cache by host, vhost, cache_status
counter nginx_http_requests_ms by le, host, vhost, method, code, backend
counter nginx_http_requests_ms by le, host, vhost, method, code
/(?P<hostname>[-0-9A-Za-z._:]+) nginx_access: (?P<vhost>[-0-9A-Za-z._:]+) \S+ (?P<remote_addr>[0-9a-f\.:]+) - - \[[^\]]+\] "(?P<request_method>[A-Z]+) (?P<request_uri>\S+) (?P<http_version>HTTP\/[0-9\.]+)" (?P<status>\d{3}) ((?P<response_size>\d+)|-) "[^"]*" "[^"]*" (?P<upstream_addr>[-0-9A-Za-z._:]+) ((?P<ups_resp_seconds>\d+\.\d+)|-) (?P<request_seconds>\d+)\.(?P<request_milliseconds>\d+) (?P<cache_status>\S+)/ {
/(?P<hostname>[-0-9A-Za-z._:]+) nginx_access: (?P<vhost>[-0-9A-Za-z._:]+) \S+ (?P<remote_addr>[0-9a-f\.:]+) - - \[[^\]]+\] "(?P<request_method>[A-Z]+) (?P<request_uri>\S+) (?P<http_version>HTTP\/[0-9\.]+)" (?P<status>\d{3}) ((?P<response_size>\d+)|-) "[^"]*" "[^"]*" ([-0-9A-Za-z._:]+) ((?P<ups_resp_seconds>\d+\.\d+)|-) (?P<request_seconds>\d+)\.(?P<request_milliseconds>\d+) (?P<cache_status>\S+)/ {
nginx_http_request_total++
nginx_http_request_total++
nginx_http_requests[$hostname][$vhost][$request_method][$status][$upstream_addr]++
nginx_http_requests_cache[$hostname][$vhost][$cache_status]++
nginx_http_bytes[$hostname][$vhost][$request_method][$status][$upstream_addr] += $response_size
nginx_http_bytes_cache[$hostname][$vhost][$cache_status] += $response_size
nginx_http_requests[$hostname][$vhost][$request_method][$status]++
nginx_http_requests_cache[$hostname][$vhost][$cache_status]++
nginx_http_bytes[$hostname][$vhost][$request_method][$status] += $response_size
nginx_http_bytes_cache[$hostname][$vhost][$cache_status] += $response_size
{# 10ms-20s buckets, with factor=sqrt(2) #}
{% for bucket_ms in [10, 14, 20, 28, 40, 57, 80, 113, 160, 226, 320, 453, 640, 905, 1280, 1810, 2560, 3620, 5119, 7239, 10238, 14479] %}
$request_seconds * 1000 + $request_milliseconds < {{ bucket_ms }} {
nginx_http_requests_ms["{{ bucket_ms }}"][$hostname][$vhost][$request_method][$status][$upstream_addr]++
}
$request_seconds * 1000 + $request_milliseconds < {{ bucket_ms }} {
nginx_http_requests_ms["{{ bucket_ms }}"][$hostname][$vhost][$request_method][$status]++
}
{% endfor %}
nginx_http_requests_ms["inf"][$hostname][$vhost][$request_method][$status][$upstream_addr]++
nginx_http_requests_ms["inf"][$hostname][$vhost][$request_method][$status]++
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment