Files
gatus/core/uptime.go
T

24 lines
905 B
Go
Raw Normal View History

2020-12-29 20:22:17 -05:00
package core
// Uptime is the struct that contains the relevant data for calculating the uptime as well as the uptime itself
// and some other statistics
2020-12-29 20:22:17 -05:00
type Uptime struct {
// HourlyStatistics is a map containing metrics collected (value) for every hourly unix timestamps (key)
2021-08-10 19:58:19 -04:00
//
// Used only if the storage type is memory
HourlyStatistics map[int64]*HourlyUptimeStatistics `json:"-"`
}
// HourlyUptimeStatistics is a struct containing all metrics collected over the course of an hour
type HourlyUptimeStatistics struct {
TotalExecutions uint64 // Total number of checks
SuccessfulExecutions uint64 // Number of successful executions
TotalExecutionsResponseTime uint64 // Total response time for all executions in milliseconds
2020-12-29 20:22:17 -05:00
}
// NewUptime creates a new Uptime
func NewUptime() *Uptime {
return &Uptime{
HourlyStatistics: make(map[int64]*HourlyUptimeStatistics),
2020-12-29 20:22:17 -05:00
}
}