diff --git a/monitoring-as-code/src/sli-value-libraries/availability-gauge-using-1-failure-metric-for-num-and-1-total-metric-for-dem.libsonnet b/monitoring-as-code/src/sli-value-libraries/availability-gauge-using-1-failure-metric-for-num-and-1-total-metric-for-dem.libsonnet index 27d724a1..5cc0c73a 100644 --- a/monitoring-as-code/src/sli-value-libraries/availability-gauge-using-1-failure-metric-for-num-and-1-total-metric-for-dem.libsonnet +++ b/monitoring-as-code/src/sli-value-libraries/availability-gauge-using-1-failure-metric-for-num-and-1-total-metric-for-dem.libsonnet @@ -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", "(.*)")) ||| % { @@ -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), @@ -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), @@ -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, diff --git a/monitoring-as-code/src/sli-value-libraries/availability-gauge-using-2-failure-metrics-for-num-and-3-metrics-dem.libsonnet b/monitoring-as-code/src/sli-value-libraries/availability-gauge-using-2-failure-metrics-for-num-and-3-metrics-dem.libsonnet index 6a968598..8104ca70 100644 --- a/monitoring-as-code/src/sli-value-libraries/availability-gauge-using-2-failure-metrics-for-num-and-3-metrics-dem.libsonnet +++ b/monitoring-as-code/src/sli-value-libraries/availability-gauge-using-2-failure-metrics-for-num-and-3-metrics-dem.libsonnet @@ -35,7 +35,7 @@ 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])) @@ -43,7 +43,7 @@ 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) ), "sli_environment", "$1", "%(environmentSelectorLabel)s", "(.*)"), "sli_product", "$1", "%(productSelectorLabel)s", "(.*)")) ||| % { @@ -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, @@ -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, @@ -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,