Skip to content

Commit

Permalink
fix: change saturation-gauge from using sum to max
Browse files Browse the repository at this point in the history
  • Loading branch information
Irene Chong committed Nov 17, 2023
1 parent dcaebed commit b670375
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ local createSliValueRule(sliSpec, sliMetadata, config) =
expr: |||
sum without (%(selectorLabels)s) (label_replace(label_replace(
(
sum by(%(selectorLabels)s) (avg_over_time((%(targetMetric)s{%(selectors)s} > bool %(counterPercentTarget)s)[%(evalInterval)s:%(evalInterval)s]))
max by(%(selectorLabels)s) (avg_over_time((%(targetMetric)s{%(selectors)s} > bool %(counterPercentTarget)s)[%(evalInterval)s:%(evalInterval)s]))
/
count by(%(selectorLabels)s) (count_over_time(%(targetMetric)s{%(selectors)s}[%(evalInterval)s]))
),
Expand Down Expand Up @@ -73,19 +73,19 @@ local createGraphPanel(sliSpec) =
).addTarget(
prometheus.target(
|||
sum(avg_over_time(%(targetMetric)s{%(selectors)s}[%(evalInterval)s]) > 0 or vector(0))
max(avg_over_time(%(targetMetric)s{%(selectors)s}[%(evalInterval)s]) > 0 or vector(0))
||| % {
targetMetric: targetMetrics.target,
counterPercentTarget: sliSpec.counterPercentTarget,
selectors: std.join(',', dashboardSelectors),
evalInterval: sliSpec.evalInterval,
},
legendFormat='avg saturation',
legendFormat='max saturation',
),
).addTarget(
prometheus.target(
|||
sum(avg_over_time((%(targetMetric)s{%(selectors)s} > bool %(counterPercentTarget)s)[%(evalInterval)s:%(evalInterval)s]) or vector(0))
max(avg_over_time((%(targetMetric)s{%(selectors)s} > bool %(counterPercentTarget)s)[%(evalInterval)s:%(evalInterval)s]) or vector(0))
/
count(count_over_time(%(targetMetric)s{%(selectors)s}[%(evalInterval)s]))
||| % {
Expand All @@ -94,16 +94,16 @@ local createGraphPanel(sliSpec) =
selectors: std.join(',', dashboardSelectors),
evalInterval: sliSpec.evalInterval,
},
legendFormat='avg period where saturation > %s percentage' % sliSpec.counterPercentTarget,
legendFormat='avg period where max saturation > %s percentage' % sliSpec.counterPercentTarget,
)
).addSeriesOverride(
{
alias: '/avg period where saturation > %s percentage/' % sliSpec.counterPercentTarget,
alias: '/avg period where max saturation > %s percentage/' % sliSpec.counterPercentTarget,
color: 'red',
},
).addSeriesOverride(
{
alias: '/avg saturation/',
alias: '/max saturation/',
color: 'green',
},
);
Expand Down

0 comments on commit b670375

Please sign in to comment.