Documentation ¶
Index ¶
Constants ¶
const MaxEventsToKeep = 64
MaxEventsToKeep is maximum number of events to keep per service before dropping old entries.
Variables ¶
This section is empty.
Functions ¶
func NullRecorder ¶
func NullRecorder(newstate ServiceState, message string, args ...any)
NullRecorder discards events.
Types ¶
type Recorder ¶
type Recorder func(newstate ServiceState, message string, args ...any)
Recorder adds new event to the history of events, formatting message with args using Sprintf.
type ServiceEvent ¶
type ServiceEvent struct { Message string State ServiceState Health health.Status Timestamp time.Time }
ServiceEvent describes state change of the running service.
func (*ServiceEvent) AsProto ¶
func (event *ServiceEvent) AsProto(service string) *machineapi.ServiceStateEvent
AsProto returns protobuf representation of respective machined event.
type ServiceEvents ¶
type ServiceEvents struct {
// contains filtered or unexported fields
}
ServiceEvents is a fixed length history of events.
func (*ServiceEvents) AsProto ¶
func (events *ServiceEvents) AsProto(count int) *machineapi.ServiceEvents
AsProto returns protobuf-ready serialized snapshot.
func (*ServiceEvents) Get ¶
func (events *ServiceEvents) Get(count int) (result []ServiceEvent)
Get return a copy of event history, with most recent event being the last one.
func (*ServiceEvents) Push ¶
func (events *ServiceEvents) Push(event ServiceEvent)
Push appends new event to the history popping out oldest event on overflow.
type ServiceState ¶
type ServiceState int
ServiceState is enum of service run states.
const ( StateInitialized ServiceState = iota StatePreparing StateWaiting StateRunning StateStopping StateFinished StateFailed StateSkipped StateStarting )
ServiceState constants.
func (ServiceState) String ¶
func (state ServiceState) String() string