-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(slo): simplify error budget calculations (#158941)
- Loading branch information
Showing
12 changed files
with
317 additions
and
570 deletions.
There are no files selected for viewing
This file contains 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
197 changes: 0 additions & 197 deletions
197
x-pack/plugins/observability/server/domain/services/compute_error_budget.test.ts
This file was deleted.
Oops, something went wrong.
101 changes: 0 additions & 101 deletions
101
x-pack/plugins/observability/server/domain/services/compute_error_budget.ts
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/observability/server/domain/services/error_budget.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { toHighPrecision } from '../../utils/number'; | ||
import { ErrorBudget } from '../models'; | ||
|
||
export function toErrorBudget( | ||
initial: number, | ||
consumed: number, | ||
isEstimated: boolean = false | ||
): ErrorBudget { | ||
return { | ||
initial: toHighPrecision(initial), | ||
consumed: toHighPrecision(consumed), | ||
remaining: toHighPrecision(1 - consumed), | ||
isEstimated, | ||
}; | ||
} |
This file contains 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
Oops, something went wrong.