You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[yugabyte#19943] docdb: Add new regex filters to Prometheus metric endpoint
Summary:
This diff creates brand new API for YBA to filter prometheus metric output, and also enable server level aggregation for all tablet and table metrics when new API is used. To enable the new API, user need to explicit add `version=v2` to the URL.
**New URL parameters for version control:**
`version`: Options(“v1”, “v2”), Default(“v1”).
"v1" means endpoint expect old regex filters:`priority_regex` and `metrics`
"v2" means endpoint expect new regex filters, and ignore the v1 filters. Tablet and table metrics will be aggregated to server level by default.
**New regex filters:**
`server_allowlist`: Options( “ALL”, “NONE”, Customized regex), Default (“ALL”)
`server_blocklist`: Options( “ALL”, “NONE”, Customized regex), Default (“NONE”)
`table_allowlist`: Options( “ALL”, “NONE”, Customized regex), Default (“ALL”)
`table_blocklist`: Options( “ALL”, “NONE”, Customized regex), Default (“NONE”)
A metric produced internally is tablet or table type will be emitted at table level if and only if it matches table_allowlist and does not match table_blocklist.
A metric produced internally is tablet, table, or server type will be emitted at the server level if and only if it matches server_allowlist and does not match server_blocklist.
**To distinguish whether a metric from the output is on stream, table, or server level:**
```
If metric_attributes contains “stream_id” :
Stream level
else if metric_attributes contains “table_id” :
Table level
else :
Server level
```
**Others:**
If we accidentally call a server without the new code using the new v2 version URL, the server will generate a huge list of metrics at the table level, which can consume large amount of memory. Thus, it is recommended to add `metrics=` in the v2 URL , so that the server will just return empty output.
URL Example: `/prometheus-metrics?version=v2&table_allowlist=<regex>&table_blocklist=<regex>&server_allowlist<regex>&server_blocklist=<regex>&metrics=`
Jira: DB-8907
Test Plan:
PrometheusMetricFilterTest.TestVOneDefault
PrometheusMetricFilterTest.TestVOnePriorityRegex
PrometheusMetricFilterTest.TestVTwoDefault
PrometheusMetricFilterTest.TestVTwoTableLevel
PrometheusMetricFilterTest.TestVTwoServerLevel
Also tested on portal
Reviewers: amitanand, esheng, rthallam, mlillibridge
Reviewed By: amitanand, esheng, mlillibridge
Subscribers: sanketh, amalyshev, nbhatia, ybase, bogdan
Differential Revision: https://phorge.dev.yugabyte.com/D31259
0 commit comments