Bars use a resolution fitting the range and the latency line is placed by time. The SLA is the share of time a monitor was not down, counted from incidents and only since the monitor exists. Monitor pages list the SLA from one hour to 90 days. Closes #59 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
16 lines
410 B
Go
16 lines
410 B
Go
package web
|
|
|
|
import (
|
|
"math"
|
|
"strconv"
|
|
)
|
|
|
|
// trimPercent cuts v to digits decimals instead of rounding, so 99.9996
|
|
// never reads as a perfect 100. The epsilon absorbs float noise such as
|
|
// 99.12 being stored as 99.1199999.
|
|
func trimPercent(v float64, digits int) string {
|
|
scale := math.Pow(10, float64(digits))
|
|
v = math.Floor(v*scale+1e-6) / scale
|
|
return strconv.FormatFloat(v, 'f', digits, 64) + "%"
|
|
}
|