Skip to content

Commit

Permalink
fix: correct avail gauge sli value libs to cater for NaNs (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpearsonHO authored Aug 9, 2023
1 parent d8def94 commit 0344c82
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ local createSliValueRule(sliSpec, sliMetadata, config) =
expr: |||
sum without (%(selectorLabels)s) (label_replace(label_replace(
(
sum by(%(selectorLabels)s) (avg_over_time(%(failureMetric)s{%(selectors)s}[%(evalInterval)s]))
sum by(%(selectorLabels)s) (avg_over_time(%(failureMetric)s{%(selectors)s}[%(evalInterval)s])>=0)
/
sum by(%(selectorLabels)s) (avg_over_time(%(totalMetric)s{%(selectors)s}[%(evalInterval)s]))
sum by(%(selectorLabels)s) (avg_over_time(%(totalMetric)s{%(selectors)s}[%(evalInterval)s])>=0)
),
"sli_environment", "$1", "%(environmentSelectorLabel)s", "(.*)"), "sli_product", "$1", "%(productSelectorLabel)s", "(.*)"))
||| % {
Expand Down Expand Up @@ -72,7 +72,7 @@ local createGraphPanel(sliSpec) =
).addTarget(
prometheus.target(
|||
sum(avg_over_time(%(totalMetric)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(totalMetric)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
||| % {
totalMetric: targetMetrics.total,
selectors: std.join(',', dashboardSelectors),
Expand All @@ -83,7 +83,7 @@ local createGraphPanel(sliSpec) =
).addTarget(
prometheus.target(
|||
sum(avg_over_time(%(failureMetric)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
||| % {
failureMetric: targetMetrics.failure,
selectors: std.join(',', dashboardSelectors),
Expand All @@ -94,9 +94,9 @@ local createGraphPanel(sliSpec) =
).addTarget(
prometheus.target(
|||
sum(avg_over_time(%(failureMetric)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
/
sum(avg_over_time(%(totalMetric)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(totalMetric)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
||| % {
failureMetric: targetMetrics.failure,
totalMetric: targetMetrics.total,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ local createSliValueRule(sliSpec, sliMetadata, config) =
sum by(%(selectorLabels)s) (avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]))
+
sum by(%(selectorLabels)s) (avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]))
)
>=0)
/
(
sum by(%(selectorLabels)s) (avg_over_time(%(successMetric)s{%(selectors)s}[%(evalInterval)s]))
+
sum by(%(selectorLabels)s) (avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]))
+
sum by(%(selectorLabels)s) (avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]))
)
>=0)
),
"sli_environment", "$1", "%(environmentSelectorLabel)s", "(.*)"), "sli_product", "$1", "%(productSelectorLabel)s", "(.*)"))
||| % {
Expand Down Expand Up @@ -84,11 +84,11 @@ local createGraphPanel(sliSpec) =
).addTarget(
prometheus.target(
|||
sum(avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
+
sum(avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
+
sum(avg_over_time(%(successMetric)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(successMetric)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
||| % {
failureMetric1: targetMetrics.failure1,
failureMetric2: targetMetrics.failure2,
Expand All @@ -101,9 +101,9 @@ local createGraphPanel(sliSpec) =
).addTarget(
prometheus.target(
|||
sum(avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
+
sum(avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
||| % {
failureMetric1: targetMetrics.failure1,
failureMetric2: targetMetrics.failure2,
Expand All @@ -116,17 +116,17 @@ local createGraphPanel(sliSpec) =
prometheus.target(
|||
(
sum(avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
+
sum(avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
)
/
(
sum(avg_over_time(%(successMetric)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(successMetric)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
+
sum(avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric1)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
+
sum(avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]) or vector(0))
sum(avg_over_time(%(failureMetric2)s{%(selectors)s}[%(evalInterval)s]) >=0 or vector(0))
)
||| % {
failureMetric1: targetMetrics.failure1,
Expand Down

0 comments on commit 0344c82

Please sign in to comment.