Skip to content

Commit 105f54a

Browse files
testing custom metrics
1 parent 3f747e8 commit 105f54a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

data/grafana/grafana.db

0 Bytes
Binary file not shown.

nginx_loadbalancer.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ http {
1313
include generic_conf/basic_vts_setup.conf;
1414
include generic_conf/setup_cache.conf;
1515

16+
1617
init_by_lua_block {
1718
loadbalancer = require "loadbalancer"
1819
loadbalancer.setup_server_list()
@@ -28,9 +29,23 @@ http {
2829

2930
server {
3031
listen 8080;
32+
vhost_traffic_status_filter_by_set_key $different_status different_status::*;
33+
set_by_lua_block $different_status {return ""}
3134

3235
location / {
3336
access_by_lua_block {
37+
local rand = math.random(0,100)
38+
39+
if rand < 50 then
40+
ngx.var.different_status = "less_50"
41+
elseif rand < 90 then
42+
ngx.var.different_status = "less_90"
43+
elseif rand < 95 then
44+
ngx.var.different_status = "less_95"
45+
else
46+
ngx.var.different_status = "more_95"
47+
end
48+
3449
loadbalancer.resolve_name_for_upstream()
3550
}
3651

0 commit comments

Comments
 (0)