diff --git a/internal/helper/type_float.go b/internal/helper/type_float.go index a841897f..e304d670 100644 --- a/internal/helper/type_float.go +++ b/internal/helper/type_float.go @@ -4,6 +4,11 @@ import ( "fmt" ) +// The SLO and burn alert APIs use 'X Per Million' to avoid the problems with floats. +// In the name of offering a nicer UX with percentages, we handle the conversion +// back and forth to allow things like 99.98 to be provided in the HCL and +// handle the conversion to and from 999800 + // FloatToPPM converts a floating point percentage to a parts per million value func FloatToPPM(f float64) int { return int(f * 10000) diff --git a/internal/helper/type_int.go b/internal/helper/type_int.go index 4e1e018e..2899aa42 100644 --- a/internal/helper/type_int.go +++ b/internal/helper/type_int.go @@ -1,5 +1,10 @@ package helper +// The SLO and burn alert APIs use 'X Per Million' to avoid the problems with floats. +// In the name of offering a nicer UX with percentages, we handle the conversion +// back and forth to allow things like 99.98 to be provided in the HCL and +// handle the conversion to and from 999800 + // converts a parts per million value to a floating point percentage func PPMToFloat(t int) float64 { return float64(t) / 10000