File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments