Skip to content

fix: block objective=100 and guard events SLI denominator against 0#800

Open
kaitimmer wants to merge 1 commit intoslok:mainfrom
kaitimmer:kaitimmer/fix-infinite-burn-rate
Open

fix: block objective=100 and guard events SLI denominator against 0#800
kaitimmer wants to merge 1 commit intoslok:mainfrom
kaitimmer:kaitimmer/fix-infinite-burn-rate

Conversation

@kaitimmer
Copy link
Copy Markdown

@kaitimmer kaitimmer commented Mar 19, 2026

Preventing infinite burn rates and issues with BurnRate calculation.

Two root causes of +Inf/-Inf error budget values are addressed:

  1. Validation (pkg/common/validation/slo.go): change objective bound from

    100 to >= 100, blocking Objective=100 which yields a zero error budget
    and causes division by zero (burn_rate = +Inf, remaining = -Inf).

  2. Events SLI template (internal/plugin/slo/core/sli_rules_v1/plugin.go): wrap the denominator with ((...) > 0) so a zero or absent denominator produces an absent result instead of +Inf. A single +Inf sample in the 5m SLI recording rule would poison sum_over_time for up to 30d, propagating +Inf through slo:period_burn_rate:ratio and flipping to -Inf in slo:period_error_budget_remaining:ratio.

All affected unit and integration golden-file tests are updated.

I think this would fix: #749

…o to prevent infinite burn rates

Two root causes of +Inf/-Inf error budget values are addressed:

1. Validation (pkg/common/validation/slo.go): change objective bound from
   > 100 to >= 100, blocking Objective=100 which yields a zero error budget
   and causes division by zero (burn_rate = +Inf, remaining = -Inf).

2. Events SLI template (internal/plugin/slo/core/sli_rules_v1/plugin.go):
   wrap the denominator with ((...) > 0) so a zero or absent denominator
   produces an absent result instead of +Inf.  A single +Inf sample in
   the 5m SLI recording rule would poison sum_over_time for up to 30d,
   propagating +Inf through slo:period_burn_rate:ratio and flipping to
   -Inf in slo:period_error_budget_remaining:ratio.

All affected unit and integration golden-file tests are updated.

Fixes: slok#749
Signed-off-by: Kai Timmer <kai@staffbase.com>
@kaitimmer kaitimmer changed the title fix: block objective=100 and guard events SLI denominator against zer… fix: block objective=100 and guard events SLI denominator against 0 Mar 19, 2026
@kaitimmer kaitimmer marked this pull request as ready for review March 19, 2026 10:23
@kaitimmer kaitimmer requested a review from slok as a code owner March 19, 2026 10:23
@kaitimmer
Copy link
Copy Markdown
Author

@slok Please let me know what I would need to do to get this moving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

infinite or negative infinite error budget

1 participant