Skip to content

Commit

Permalink
Add counter panels to rate limiter dashboard (#3064)
Browse files Browse the repository at this point in the history
### 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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## 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.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
karansohi authored Dec 19, 2023
1 parent 4b76367 commit c857905
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions dashboards/grafana/dashboards/summary/rate-limiter/rows.libsonnet
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 })
Expand All @@ -18,7 +56,7 @@ function(datasourceName, policyName, component, extraFilters={})
else
[];

local row1 = [
local row2 = [
timeSeriesPanel(
'Aperture Rate Limiter',
datasourceName,
Expand All @@ -28,4 +66,4 @@ function(datasourceName, policyName, component, extraFilters={})
),
];

[row1]
[row1, row2]

0 comments on commit c857905

Please sign in to comment.