23 Jul 2024 08:50 AM
I need to monitor the failure rate of a web service by a request attribute called "usecase." For this, I created a custom counter metric using the AppMetrics package and defined a Metric Event with the following selector:
(custom_counter.count:filter(and(eq("k8s.namespace.name","prod"), not(eq(status_code,"200")), not(eq(status_code,"503")))):splitBy(usecase):value /
custom_counter.count:filter(eq("k8s.namespace.name","prod")):splitBy(usecase):value * 100):setUnit(Percent):sort(value(auto,descending)):limit(7)
Here, I calculate the ratio of unsuccessful requests over the total number of requests per use case and return the top 7 use cases with the highest failure rate.
The metric event shows a warning:
The number of metric dimension values in the last 24 hours (4922) exceeds the limit of 1000. Please refine the filter criteria or use a metric key based query definition.
My question is: How is the number 4922 calculated?
When I call the api/v2/metrics/query endpoint with the same selector, timeframe of 24h, and resolution of 1m, I receive a response with 7 use cases, each having 1440 dimension values. The total number is 10080.
I would like to understand the formula for calculating the total number of dimension values per metric event so that I can adjust the metric selector to meet the limit.