Fix: denominator_corrected_rules/v1 (complex queries + negative SLIs) - #846
Open
r3code wants to merge 2 commits into
Open
Fix: denominator_corrected_rules/v1 (complex queries + negative SLIs)#846r3code wants to merge 2 commits into
r3code wants to merge 2 commits into
Conversation
Closes slok#804 Signed-off-by: Dmitriy S. Sinyavskiy <contact@r3code.ru>
On services with historically low or absent traffic that suddenly start receiving load, the SLI calculation produced negative values (in practice, values around ~-52000% were observed). Root cause: the denominator_corrected_rules_v1 plugin computes the correction factor as k = rate(5m) / rate(30d). When rate_30d is close to zero (e.g. 0.0001 req/s) and a traffic spike brings rate_5m up to 1.0 req/s, k skyrockets to ~10000, which overflows the SLI formula (1 - k * bad/total). The fix caps the correction factor at 1.0 by wrapping the ratio in clamp_max(..., 1.0), so the plugin only lowers the significance of errors during anomalously low traffic and can no longer amplify them during spikes after idle periods.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #846 +/- ##
=======================================
Coverage 31.30% 31.30%
=======================================
Files 149 149
Lines 9228 9228
=======================================
Hits 2889 2889
Misses 6088 6088
Partials 251 251 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It fixes 2 issues of denominator_corrected_rules/v1 plugin: