Skip to content

Commit

Permalink
testing custom metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
leandromoreira committed Jan 19, 2022
1 parent 3f747e8 commit 105f54a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Binary file modified data/grafana/grafana.db
Binary file not shown.
15 changes: 15 additions & 0 deletions nginx_loadbalancer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ http {
include generic_conf/basic_vts_setup.conf;
include generic_conf/setup_cache.conf;


init_by_lua_block {
loadbalancer = require "loadbalancer"
loadbalancer.setup_server_list()
Expand All @@ -28,9 +29,23 @@ http {

server {
listen 8080;
vhost_traffic_status_filter_by_set_key $different_status different_status::*;
set_by_lua_block $different_status {return ""}

location / {
access_by_lua_block {
local rand = math.random(0,100)

if rand < 50 then
ngx.var.different_status = "less_50"
elseif rand < 90 then
ngx.var.different_status = "less_90"
elseif rand < 95 then
ngx.var.different_status = "less_95"
else
ngx.var.different_status = "more_95"
end

loadbalancer.resolve_name_for_upstream()
}

Expand Down

0 comments on commit 105f54a

Please sign in to comment.