mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-15 17:51:09 +00:00
9d151fcdb4
* refactor: Partially break core package into dns, result and ssh packages * refactor: Move core package to config/endpoint * refactor: Fix warning about overlapping imported package name with endpoint variable * refactor: Rename EndpointStatus to Status * refactor: Merge result pkg back into endpoint pkg, because it makes more sense * refactor: Rename parameter r to result in Condition.evaluate * refactor: Rename parameter r to result * refactor: Revert accidental change to endpoint.TypeDNS * refactor: Rename parameter r to result * refactor: Merge util package into endpoint package * refactor: Rename parameter r to result
24 lines
909 B
Go
24 lines
909 B
Go
package endpoint
|
|
|
|
// Uptime is the struct that contains the relevant data for calculating the uptime as well as the uptime itself
|
|
// and some other statistics
|
|
type Uptime struct {
|
|
// HourlyStatistics is a map containing metrics collected (value) for every hourly unix timestamps (key)
|
|
//
|
|
// 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
|
|
}
|
|
|
|
// NewUptime creates a new Uptime
|
|
func NewUptime() *Uptime {
|
|
return &Uptime{
|
|
HourlyStatistics: make(map[int64]*HourlyUptimeStatistics),
|
|
}
|
|
}
|