metrics

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package metrics samples container CPU/memory into a SQLite ring buffer for the per-service graphs, plus host CPU/mem/disk under "server:local" refs for the servers screen. No Prometheus, on purpose.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StoreHostSample

func StoreHostSample(ctx context.Context, store repo.Store, ref string, now time.Time, s hostmetrics.HostSample)

StoreHostSample writes one host reading under a server ref. The manager samples itself through sampleHost; a worker's arrives from its agent and lands here too, so both nodes' graphs read the same rows.

Types

type Sampler

type Sampler struct {
	// contains filtered or unexported fields
}

func NewSampler

func NewSampler(store repo.Store, clus *cluster.Cluster, notifier *notify.Notifier) *Sampler

func (*Sampler) Run

func (s *Sampler) Run(ctx context.Context)

Run blocks; call in a goroutine.

func (*Sampler) RunFlows

func (s *Sampler) RunFlows(ctx context.Context)

RunFlows samples inter-tile traffic on a fast tick so the graph overlay tracks load changes in seconds, decoupled from the 30s metrics cadence. Blocks; call in a goroutine.

func (*Sampler) SliceStats

func (s *Sampler) SliceStats() map[string]SliceStat

SliceStats returns the latest per-resource database stats (copy).

func (*Sampler) Snapshot

func (s *Sampler) Snapshot() Traffic

Snapshot returns the latest flow rates (copy).

type SliceStat

type SliceStat struct {
	TxnRate float64 // transactions/second since the previous sample
	Size    int64   // bytes on disk
}

SliceStat is what a slice card shows: how busy the database is, and how big.

type Traffic

type Traffic struct {
	Pairs map[string]float64 // bytes/second, directional
	At    time.Time
}

Traffic is the latest observed inter-node flow snapshot. Pair keys are "<fromRef>|<toRef>" using graph refs ("app:<id>", "db:<id>", "proxy").

Jump to

Keyboard shortcuts

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