Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-sb-devops
Commits
2564124e
Commit
2564124e
authored
4 years ago
by
Rajesh Rajendran
Browse files
Options
Download
Patches
Plain Diff
Updating default nginx config
Signed-off-by:
Rajesh Rajendran
<
rjshrjndrn@gmail.com
>
parent
cc518967
loadtest-release-2.10.0_nginx_prometheus
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
images/proxy/nginx.conf
+8
-3
images/proxy/nginx.conf
with
8 additions
and
3 deletions
+8
-3
images/proxy/nginx.conf
+
8
−
3
View file @
2564124e
...
...
@@ -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
10
0
M
;
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
}
)
'
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets