model

package
v0.0.0-...-b973d07 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package model holds the types shared by collectors, the store, the API and both front ends.

Index

Constants

View Source
const (
	SevInfo     = "info"
	SevWarn     = "warn"
	SevError    = "error"
	SevCritical = "critical"
)

Severity of an event.

View Source
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.

View Source
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

func GroupName

func GroupName(g Group) string

GroupName returns a short name for a group.

func Now

func Now() int64

Now returns the current time in unix nanoseconds.

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.

const (
	KindGauge    Kind = 1
	KindCounter  Kind = 2
	KindHistPart Kind = 3
)

Series kinds.

func (Kind) IsCumulative

func (k Kind) IsCumulative() bool

IsCumulative reports whether a series kind is a cumulative counter.

func (Kind) String

func (k Kind) String() string

type Label

type Label struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Label is one name=value pair.

type Labels

type Labels []Label

Labels is a label set sorted by name.

func ParseLabels

func ParseLabels(s string) Labels

ParseLabels parses the canonical form written by Labels.String.

func (Labels) Get

func (ls Labels) Get(name string) string

Get returns a label value, or "".

func (Labels) Map

func (ls Labels) Map() map[string]string

Map returns the labels as a map.

func (Labels) Sort

func (ls Labels) Sort()

Sort sorts the labels by name.

func (Labels) String

func (ls Labels) String() string

String renders the canonical form a=b,c=d. Callers sort first.

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.

func (Silence) Active

func (s Silence) Active(t int64, node, rule string) bool

Active reports whether the silence covers node and rule at t.

Jump to

Keyboard shortcuts

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