health

package
v0.0.0-...-a49da23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckData

type CheckData struct {
	Unstructured      map[string]interface{}
	CheckState        *CheckState
	CheckStateDeleted *CheckStateDeleted
}

CheckData describes state of a health stream it's an enumeration - only one of the fields should be filled Unstructured is intended to be used to pass through Python health state data see other type's description

func (*CheckData) IsEmpty

func (c *CheckData) IsEmpty() bool

IsEmpty checks if the data is empty (can come from Python check)

func (*CheckData) JSONString

func (c *CheckData) JSONString() string

JSONString encodes input into JSON while also encoding an error - for logging purpose

func (CheckData) MarshalJSON

func (c CheckData) MarshalJSON() ([]byte, error)

MarshalJSON ensures one of the cases is rendered

func (*CheckData) UnmarshalJSON

func (c *CheckData) UnmarshalJSON(buf []byte) error

UnmarshalJSON unmarshalls data from json

type CheckState

type CheckState struct {
	CheckStateID              string `json:"checkStateId"`              // Identifier for the check state in the external system
	Message                   string `json:"message,omitempty"`         // Message to display in StackState UI. Data will be interpreted as markdown allowing to have links to the external system check that generated the external check state.
	Health                    State  `json:"health"`                    // StackState Health state
	TopologyElementIdentifier string `json:"topologyElementIdentifier"` // Used to bind the check state to a StackState topology element
	Name                      string `json:"name"`                      // Name of the external check state.
}

CheckState describes state of a health stream see also: https://docs.stackstate.com/configure/health/send-health-data/repeat_snapshots https://docs.stackstate.com/configure/health/send-health-data/repeat_states https://docs.stackstate.com/configure/health/send-health-data/transactional_increments

type CheckStateDeleted

type CheckStateDeleted struct {
	CheckStateID string `json:"checkStateId"` // Identifier for the check state in the external system
	Delete       bool   `json:"delete"`       // should be true
}

CheckStateDeleted describes signals StackState to delete a health stream

type Health

type Health struct {
	StartSnapshot *StartSnapshotMetadata `json:"start_snapshot,omitempty"`
	StopSnapshot  *StopSnapshotMetadata  `json:"stop_snapshot,omitempty"`
	Stream        Stream                 `json:"stream"`
	CheckStates   []CheckData            `json:"check_states"`
}

Health is a batch of health synchronization data

type Payload

type Payload struct {
	Stream Stream
	Data   CheckData
}

Payload is a single payload for the batch of health synchronization data

func (Payload) JSONString

func (p Payload) JSONString() string

JSONString returns a JSON string of the Payload

type StartSnapshotMetadata

type StartSnapshotMetadata struct {
	RepeatIntervalS int `json:"repeat_interval_s"`
	ExpiryIntervalS int `json:"expiry_interval_s,omitempty"`
}

StartSnapshotMetadata is a representation of 'start' for health synchronization

type State

type State string

State health state of a health stream

const (
	// Clear designates healthy component
	Clear State = "CLEAR"
	// Deviating means a component is working but something is wrong[
	Deviating State = "DEVIATING"
	// Critical means that component is suffering
	Critical State = "CRITICAL"
)

type StopSnapshotMetadata

type StopSnapshotMetadata struct{}

StopSnapshotMetadata is a representation of 'stop' for health synchronization

type Stream

type Stream struct {
	Urn       string `json:"urn"`
	SubStream string `json:"sub_stream_id,omitempty"`
}

Stream is a representation of a health stream for health synchronization

func (*Stream) GoString

func (i *Stream) GoString() string

GoString prints as string, can also be used in maps

func (*Stream) UnmarshalJSON

func (i *Stream) UnmarshalJSON(buf []byte) error

UnmarshalJSON decodes Stream in a way to be compatible with Python check (sub_stream -> SubStream) while keeping original encoding (SubStream `json:sub_stream_id`) compatible with intake API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL