Introduction
We can access stats of envoy at /stats api on admin address from browser [e.g. http://10.19.8.44:9901/stats] . We can disable specific stats using stats_config in envoy.yaml . We can specify a pattern match to exclude a specific stat. A sample config to disable stats of two specific listeners is as follows:
#envoy.yaml file
# It will disable stats of format listerner.<listener_name>...
# We can provide listener names to disable above format stats
stats_config:
stats_matcher:
exclusion_list:
patterns:
- contains: "listener_1" #first listener name
- contains: "listener_2" #second listener name
stats_config
We have following fields under stats_config:
{
"stats_tags": [],
"use_all_default_tags": {...},
"stats_matcher": {...},
"histogram_bucket_settings": []
}
We have following fields under stats_matcher:
{
"reject_all": ...,
"exclusion_list": {...},
"inclusion_list": {...}
}
We can use exclusion_list to specify match string for specific stats. We have following field under exclusion_list:
{
"patterns": []
}
patterns is of type [repeated type.matcher.v3.StringMatcher] i.e. list of StringMatcher .
We have following fields under StringMatcher:
{
"exact": ...,
"prefix": ...,
"suffix": ...,
"safe_regex": {...},
"contains": ...,
"custom": {...},
"ignore_case": ...
}
So, we can use above string matchers to match the stat that we need to disable. In sample config, we used contains i.e. if the stats have specified string then that stats will be disabled.
Similarly, we can use other options like
- exact for exact match
- prefix for matching prefix
- safe_regex to specify some regex to match the stat to be disabled
Leave a comment