2021-10-23 20:47:12 +00:00
|
|
|
package core
|
|
|
|
|
2022-06-21 01:25:14 +00:00
|
|
|
import "github.com/TwiN/gatus/v4/util"
|
2021-10-23 20:47:12 +00:00
|
|
|
|
|
|
|
// EndpointStatus contains the evaluation Results of an Endpoint
|
|
|
|
type EndpointStatus struct {
|
|
|
|
// Name of the endpoint
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
|
|
|
|
// Group the endpoint is a part of. Used for grouping multiple endpoints together on the front end.
|
|
|
|
Group string `json:"group,omitempty"`
|
|
|
|
|
|
|
|
// Key is the key representing the EndpointStatus
|
|
|
|
Key string `json:"key"`
|
|
|
|
|
|
|
|
// Results is the list of endpoint evaluation results
|
|
|
|
Results []*Result `json:"results"`
|
|
|
|
|
|
|
|
// Events is a list of events
|
2021-11-05 01:33:13 +00:00
|
|
|
Events []*Event `json:"events,omitempty"`
|
2021-10-23 20:47:12 +00:00
|
|
|
|
|
|
|
// Uptime information on the endpoint's uptime
|
|
|
|
//
|
|
|
|
// Used by the memory store.
|
|
|
|
//
|
|
|
|
// To retrieve the uptime between two time, use store.GetUptimeByKey.
|
|
|
|
Uptime *Uptime `json:"-"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewEndpointStatus creates a new EndpointStatus
|
|
|
|
func NewEndpointStatus(group, name string) *EndpointStatus {
|
|
|
|
return &EndpointStatus{
|
|
|
|
Name: name,
|
|
|
|
Group: group,
|
|
|
|
Key: util.ConvertGroupAndEndpointNameToKey(group, name),
|
|
|
|
Results: make([]*Result, 0),
|
|
|
|
Events: make([]*Event, 0),
|
|
|
|
Uptime: NewUptime(),
|
|
|
|
}
|
|
|
|
}
|