exchange-latency.conf.j2 (1568B)
1 # Managed by Ansible. Only the exchange virtual host uses $exchange_log_perf. 2 # 0: unknown/mutation, 1: ordinary GET, 2: optional polling, 3: purse polling. 3 map "$request_method:$uri" $exchange_latency_get_route { 4 default 0; 5 {% if enable_monitoring | default(false) | bool and monitoring_nginx_latency_enabled | default(false) | bool %} 6 {% for route in monitoring_nginx_latency_routes if route.method == 'GET' %} 7 {{ ('~^GET:' ~ route.pattern ~ '$') | to_json }} {{ route.polling }}; 8 {% endfor %} 9 {% endif %} 10 } 11 12 # Do not persist query strings. Treat encoded/ambiguous query arguments as 13 # potentially polling on polling-capable routes. Backend argument decoding 14 # differs from nginx's $arg_* lookup, particularly for encoded parameter names. 15 map $args $exchange_latency_args_ambiguous { 16 default 0; 17 ~[%+] 1; 18 ~*(^|&)timeout_ms(?:=[^&]*)?(?:&[^&]*)*&timeout_ms(?:=|&|$) 1; 19 ~*(^|&)deposit_timeout_ms(?:=[^&]*)?(?:&[^&]*)*&deposit_timeout_ms(?:=|&|$) 1; 20 } 21 map $args $exchange_latency_timeout_safe { 22 default 1; 23 ~*(^|&)timeout_ms=0+(&|$) 1; 24 ~*(^|&)timeout_ms(=|&|$) 0; 25 } 26 map $args $exchange_latency_deposit_timeout_safe { 27 default 1; 28 ~*(^|&)deposit_timeout_ms=0+(&|$) 1; 29 ~*(^|&)deposit_timeout_ms(=|&|$) 0; 30 } 31 map "$exchange_latency_get_route:$exchange_latency_args_ambiguous:$exchange_latency_timeout_safe:$exchange_latency_deposit_timeout_safe" $exchange_latency_get_allowed { 32 default 0; 33 ~^1: 1; 34 ~^2:0:1: 1; 35 "3:0:1:1" 1; 36 } 37 map $exchange_latency_get_allowed $exchange_log_perf { 38 default $log_perf; 39 1 1; 40 }