Commit 2564124e authored by Rajesh Rajendran's avatar Rajesh Rajendran
Browse files

Updating default nginx config


Signed-off-by: default avatarRajesh Rajendran <rjshrjndrn@gmail.com>
No related merge requests found
Showing with 8 additions and 3 deletions
+8 -3
......@@ -23,13 +23,18 @@ http {
access_log /var/log/nginx/access.log main;
# Shared dictionary to store metrics
lua_shared_dict prometheus_metrics 10M;
lua_shared_dict prometheus_metrics 100M;
lua_package_path "/etc/nginx/lua_modules/?.lua";
# Defining upstream cache status for nginx metrics
map $upstream_cache_status $cache_status {
default $upstream_cache_status;
'' "NONE";
}
# Defining metrics
init_by_lua '
prometheus = require("prometheus").init("prometheus_metrics")
metric_requests = prometheus:counter(
"nginx_http_requests_total", "Number of HTTP requests", {"host", "status", "request_method"})
"nginx_http_requests_total", "Number of HTTP requests", {"host", "status", "request_method", "cache_status"}
metric_latency = prometheus:histogram(
"nginx_http_request_duration_seconds", "HTTP request latency", {"host"})
metric_connections = prometheus:gauge(
......@@ -38,7 +43,7 @@ http {
# Collecting metrics
log_by_lua '
metric_requests:inc(1, {ngx.var.server_name, ngx.var.status, ngx.var.request_method})
metric_requests:inc(1, {ngx.var.server_name, ngx.var.status, ngx.var.request_method, ngx.var.cache_status})
metric_latency:observe(tonumber(ngx.var.request_time), {ngx.var.server_name})
';
......
Supports Markdown
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