gatus/core/service_status.go

39 lines
1.0 KiB
Go
Raw Normal View History

2020-11-27 00:09:01 +01:00
package core
// ServiceStatus contains the evaluation Results of a Service
type ServiceStatus struct {
// Name of the service
Name string `json:"name,omitempty"`
2020-11-27 00:09:01 +01:00
// Group the service is a part of. Used for grouping multiple services together on the front end.
Group string `json:"group,omitempty"`
// Key is the key representing the ServiceStatus
Key string `json:"key"`
2020-11-27 00:09:01 +01:00
// Results is the list of service evaluation results
Results []*Result `json:"results"`
2021-01-29 04:44:31 +01:00
// Events is a list of events
Events []*Event `json:"events"`
2021-01-29 04:44:31 +01:00
// Uptime information on the service's uptime
2021-02-03 05:06:34 +01:00
//
// Used by the memory store.
2021-08-13 03:54:23 +02:00
//
// To retrieve the uptime between two time, use store.GetUptimeByKey.
2021-02-03 05:06:34 +01:00
Uptime *Uptime `json:"-"`
2020-11-27 00:09:01 +01:00
}
// NewServiceStatus creates a new ServiceStatus
2021-07-14 07:53:14 +02:00
func NewServiceStatus(serviceKey, serviceGroup, serviceName string) *ServiceStatus {
2020-11-27 00:09:01 +01:00
return &ServiceStatus{
2021-07-14 07:53:14 +02:00
Name: serviceName,
Group: serviceGroup,
Key: serviceKey,
2020-11-27 00:09:01 +01:00
Results: make([]*Result, 0),
2021-07-14 07:53:14 +02:00
Events: make([]*Event, 0),
Uptime: NewUptime(),
2020-11-27 00:09:01 +01:00
}
}