Skip to content

Commit

Permalink
add comments to new helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
lafentres committed Nov 15, 2023
1 parent 851f02d commit 565749c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/helper/type_float.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions internal/helper/type_int.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 565749c

Please sign in to comment.