Documentation
¶
Overview ¶
Package model holds the types shared by collectors, the store, the API and both front ends.
Index ¶
Constants ¶
const ( SevInfo = "info" SevWarn = "warn" SevError = "error" SevCritical = "critical" )
Severity of an event.
const ( EvRestart = "restart" EvVersion = "version" EvConfigPending = "config-pending" EvConfigEffective = "config-effective" EvCatchupStart = "catchup-start" EvCatchupEnd = "catchup-end" EvLogRotation = "log-rotation" EvCounterReset = "counter-reset" EvDisconnect = "disconnect" EvConnect = "connect" EvLogError = "log-error" EvLogWarn = "log-warn" EvAlertFired = "alert-fired" EvAlertRepeated = "alert-repeated" EvAlertCleared = "alert-cleared" EvSilenceStart = "silence-start" EvSilenceEnd = "silence-end" EvMonitorGap = "monitor-gap" EvRetention = "retention-deletion" EvClockJump = "clock-jump" EvNodeDown = "node-down" EvNodeUp = "node-up" EvAnnotation = "annotation" )
Event kinds.
const ( // EvAlertUndelivered is a notification that failed on its channel // after every retry. EvAlertUndelivered = "alert-undelivered" // EvConfigError is a part of the config that could not take effect, // such as an alert rule that does not parse. EvConfigError = "config-error" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Annotation ¶
type Annotation struct {
ID string `json:"id"`
Node string `json:"node,omitempty"` // empty means every node
Start int64 `json:"start"`
End int64 `json:"end,omitempty"`
Text string `json:"text"`
Auto bool `json:"auto,omitempty"`
Silence string `json:"silence,omitempty"` // silence ID carried by this annotation
Created int64 `json:"created"`
Author string `json:"author,omitempty"`
}
Annotation is a user note over a time range.
type Batch ¶
type Batch struct {
Node string
Group Group
Time int64 // unix nanoseconds
Samples []Sample
// Reset marks a restart: every counter of the node resets at Time.
Reset bool
}
Batch is one collector pass for one node and group.
type Event ¶
type Event struct {
Time int64 `json:"time"`
Node string `json:"node"`
Kind string `json:"kind"`
Severity string `json:"severity"`
Msg string `json:"msg"`
Attrs map[string]any `json:"attrs,omitempty"`
}
Event is something that happened at a point in time.
type Group ¶
type Group uint8
Group is a collector group. Each group samples on its own clock and gets its own timestamp column in a block.
const ( GroupMetrics Group = 1 // algod /metrics GroupREST Group = 2 // status, health, pool, participation GroupRound Group = 3 // round watcher GroupProc Group = 4 // process stats GroupNet Group = 5 // per-process network bytes GroupHost Group = 6 // host stats GroupLog Group = 7 // log-derived counts GroupPeers Group = 8 // peer counts GroupSelf Group = 9 // algodtop's own stats GroupBlock Group = 10 // block headers, fetched after each round )
Collector groups.
type Kind ¶
type Kind uint8
Kind is how a series is stored and aggregated.
func (Kind) IsCumulative ¶
IsCumulative reports whether a series kind is a cumulative counter.
type Labels ¶
type Labels []Label
Labels is a label set sorted by name.
func ParseLabels ¶
ParseLabels parses the canonical form written by Labels.String.
type PeerUsage ¶
type PeerUsage struct {
Time int64 `json:"time"`
Key string `json:"key"` // session key: peer ID for p2p, address for ws
Network string `json:"network"`
Direction string `json:"direction"`
Addr string `json:"addr"`
BytesIn int64 `json:"bytes_in"`
BytesOut int64 `json:"bytes_out"`
Streams []string `json:"streams,omitempty"`
}
PeerUsage is one per-peer usage sample from /v2/node/peers.
type Sample ¶
type Sample struct {
Name string
Labels Labels
Kind Kind
Value float64
// LabelKey is Labels.String() when the producer has it cached.
LabelKey string
}
Sample is one value for one series.
type Session ¶
type Session struct {
Node string `json:"node"`
Network string `json:"network"` // ws or p2p
Direction string `json:"direction"` // in or out
Addr string `json:"addr"` // remote address as reported
IP string `json:"ip"` // parsed remote IP
PeerID string `json:"peer_id,omitempty"`
Start int64 `json:"start"`
End int64 `json:"end,omitempty"` // 0 while open
Reason string `json:"reason,omitempty"`
Source string `json:"source"` // log or poll
// OpenBefore marks a session that was already open when algodtop
// first looked, so Start is later than the real connect.
OpenBefore bool `json:"open_before,omitempty"`
BytesIn int64 `json:"bytes_in,omitempty"`
BytesOut int64 `json:"bytes_out,omitempty"`
Protocols []string `json:"protocols,omitempty"`
}
Session is one peer connection's lifetime.
type Silence ¶
type Silence struct {
ID string `json:"id"`
Nodes []string `json:"nodes,omitempty"` // empty means every node
Rules []string `json:"rules,omitempty"` // empty means every rule
Start int64 `json:"start"`
End int64 `json:"end"`
Comment string `json:"comment"`
Created int64 `json:"created"`
}
Silence suppresses alert notifications.