From c857905d73cbb7f962469da142ff407763537811 Mon Sep 17 00:00:00 2001 From: Karanbir Singh <65090469+karansohi@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:14:52 -0800 Subject: [PATCH] Add counter panels to rate limiter dashboard (#3064) ### Description of change ##### Checklist - [ ] Tested in playground or other setup - [ ] Screenshot (Grafana) from playground added to PR for 15+ minute run - [ ] Documentation is changed or added - [ ] Tests and/or benchmarks are included - [ ] Breaking changes ## Summary by CodeRabbit - **New Features** - Introduced a new row with a time series panel for enhanced data visualization on the rate limiter dashboard. - Expanded dashboard content with additional statistical panels for more comprehensive data analysis. - **Refactor** - Improved dashboard layout to accommodate new visual elements and data queries. --- .../summary/rate-limiter/rows.libsonnet | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/dashboards/grafana/dashboards/summary/rate-limiter/rows.libsonnet b/dashboards/grafana/dashboards/summary/rate-limiter/rows.libsonnet index 11f3e651c1..8426bbe190 100644 --- a/dashboards/grafana/dashboards/summary/rate-limiter/rows.libsonnet +++ b/dashboards/grafana/dashboards/summary/rate-limiter/rows.libsonnet @@ -1,3 +1,4 @@ +local statPanel = import '../../../panels/stat.libsonnet'; local timeSeriesPanel = import '../../../panels/time-series.libsonnet'; local portUtils = import '../../../utils/port.libsonnet'; local prometheusUtils = import '../../../utils/prometheus.libsonnet'; @@ -7,6 +8,43 @@ function(datasourceName, policyName, component, extraFilters={}) local componentID = std.get(component.component, 'parent_component_id', default=component.component_id); local stringFilters = prometheusUtils.dictToPrometheusFilter(extraFilters { policy_name: policyName, component_id: componentID }); + + local row1 = [ + statPanel( + 'Total Requests', + datasourceName, + 'sum(increase(rate_limiter_counter_total{%(filters)s}[$__range]))' % { filters: stringFilters }, + x=0, + h=10, + w=8, + panelColor='blue', + graphMode='area', + unit='short' + ), + statPanel( + 'Total Accepted Requests', + datasourceName, + 'sum(increase(rate_limiter_counter_total{%(filters)s, decision_type="DECISION_TYPE_ACCEPTED"}[$__range]))' % { filters: stringFilters }, + x=8, + h=10, + w=8, + graphMode='area', + unit='short' + ), + statPanel( + 'Total Rejected Requests', + datasourceName, + 'sum(increase(rate_limiter_counter_total{%(filters)s, decision_type="DECISION_TYPE_REJECTED"}[$__range]))' % { filters: stringFilters }, + x=16, + h=10, + w=8, + panelColor='red', + graphMode='area', + noValue='No rejected requests', + unit='short' + ), + ]; + local targets = [ g.query.prometheus.new(datasourceName, 'sum by(decision_type) (rate(rate_limiter_counter_total{%(filters)s}[$__rate_interval]))' % { filters: stringFilters }) @@ -18,7 +56,7 @@ function(datasourceName, policyName, component, extraFilters={}) else []; - local row1 = [ + local row2 = [ timeSeriesPanel( 'Aperture Rate Limiter', datasourceName, @@ -28,4 +66,4 @@ function(datasourceName, policyName, component, extraFilters={}) ), ]; - [row1] + [row1, row2]