metrics

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 6 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 metrics is the host's Prometheus registry: the admission stage histogram (R1), the per-object work histograms (R2), CPU attribution (R3) and the submit/lookup counters, all under the overlay_go_ prefix.

Every labelled series with a bounded label set is created at zero at startup. A counter that is absent until its first event matches nothing in a rate() and reads exactly like a healthy host, which is the silent failure an alert on it exists to catch.

Index

Constants

View Source
const (
	ModuleMulti = "multi"
	ModuleNone  = "none"
)

Module label values beside the mounted module names: a submission whose topics belong to more than one module, and one with no mounted owner (a host never answers one, so a series under it is a bug).

View Source
const (
	ResultOK          = "ok"          // the engine answered a STEAK
	ResultMalformed   = "malformed"   // bad header, body or BEEF: the client's fault
	ResultRefused     = "refused"     // SPV or the fee floor refused the object
	ResultUnavailable = "unavailable" // SPV could not reach a verdict (tracker, not yet, deadline)
	ResultPending     = "pending"     // kept for label stability; the ordinary path never answers it
	ResultError       = "error"       // the engine or storage failed
)

Submit results, the label values of overlay_go_submits_total.

View Source
const Namespace = "overlay_go"

Namespace is the metric-name prefix of every family this host emits.

Variables

View Source
var (
	GASPSyncResults   = []string{"ok", "incomplete", "peer-error", "error"}
	GASPObjectResults = []string{"admitted", "duplicate", "refused", "retry", "failed", "skipped", "expired"}
	GASPRoutes        = []string{"sync", "node"}
	GASPServedResults = []string{"ok", "malformed", "unknown-topic", "replay-only", "not-found", "forbidden", "limited", "error"}
)

GASP results: the result label values of overlay_go_gasp_syncs_total, overlay_go_gasp_objects_total and overlay_go_gasp_served_total.

View Source
var (
	ReplayRoundResults    = []string{"ok", "incomplete", "peer-error", "error"}
	ReplayObjectResults   = []string{"admitted", "duplicate", "refused", "retry", "failed", "waiting", "skipped"}
	ReplayQuestionResults = []string{"ok", "refused"}
	// CatchupKinds label overlay_go_catchup_held_total and _seconds_total.
	CatchupKinds = []string{"gasp", "replay"}
)

Replay results: the result label values of overlay_go_replay_rounds_total, overlay_go_replay_objects_total and overlay_go_replay_questions_total.

View Source
var BridgeMarkerResults = []string{"accepted", "disabled", "not_loopback", "bad_mac"}

BridgeMarkerResults are the result label values of overlay_go_bridge_marker_total (internal/bridgetrust's Results).

View Source
var GCClasses = []string{"dropped", "rowless", "unreferenced", "meta", "temp"}

GCClasses are the class label values of overlay_go_store_gc_removed_total.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	Reg *prometheus.Registry

	Submits       *prometheus.CounterVec
	TopicSubmits  *prometheus.CounterVec
	Admissions    *prometheus.CounterVec
	TopicFailures *prometheus.CounterVec
	Lookups       *prometheus.CounterVec
	Verify        *prometheus.CounterVec
	// BridgeMarker counts overlay-bridge SPV markers by how they were
	// judged (internal/bridgetrust); accepted = scripts skipped.
	BridgeMarker *prometheus.CounterVec

	Stage     *prometheus.HistogramVec
	Admission *prometheus.HistogramVec

	ObjectTransactions prometheus.Histogram
	ObjectInputs       prometheus.Histogram
	ObjectDepth        prometheus.Histogram

	Ready        prometheus.Gauge
	ReconcileTip prometheus.Gauge
	Reconciles   *prometheus.CounterVec
	BuildInfo    *prometheus.GaugeVec
	Duplicates   *prometheus.CounterVec

	// Storage (pkg/store).
	StoreInfo           *prometheus.GaugeVec
	StoreOps            *prometheus.HistogramVec
	StoreWALSyncs       prometheus.Counter
	StoreWALSync        prometheus.Histogram
	RetentionRuns       *prometheus.CounterVec
	RetentionRun        prometheus.Histogram
	RetentionUnlinked   prometheus.Counter
	RetentionBytes      prometheus.Counter
	RetentionCandidates prometheus.Gauge
	Checkpoints         *prometheus.CounterVec
	// CheckpointPause is how long a checkpoint held admissions and every
	// index write (the index copy and the state files' links).
	CheckpointPause prometheus.Histogram
	// Prune is the anytx retention (pkg/store prune.go); PresetPrune
	// creates the per-topic series once the pruned topics are known.
	PruneRuns         *prometheus.CounterVec
	PruneRun          prometheus.Histogram
	PrunedOutputs     *prometheus.CounterVec
	PrunedApplied     *prometheus.CounterVec
	PrunedTxs         prometheus.Counter
	PrunedBlobBytes   prometheus.Counter
	PruneOldestSecond *prometheus.GaugeVec
	// GC (pkg/store gc.go).
	GCRuns    *prometheus.CounterVec
	GCRemoved *prometheus.CounterVec
	GCBytes   *prometheus.CounterVec

	// GASP catch-up (internal/catchup). PresetGASP creates the per-peer and
	// per-topic series once the peers and the topics GASP carries are known.
	GASPSyncs   *prometheus.CounterVec
	GASPObjects *prometheus.CounterVec
	GASPNodes   *prometheus.CounterVec
	GASPServed  *prometheus.CounterVec
	GASPSync    prometheus.Histogram
	GASPPeers   prometheus.Gauge

	// Ordered replay (internal/catchup, ruling R-o): the topics GASP never
	// carries, repaired by their module's replayer from the same peers.
	// PresetReplay creates the series once the peers and topics are known.
	ReplayRounds    *prometheus.CounterVec
	ReplayObjects   *prometheus.CounterVec
	ReplayQuestions *prometheus.CounterVec
	ReplayGaps      *prometheus.GaugeVec
	ReplayRound     prometheus.Histogram
	ReplayTopics    prometheus.Gauge

	// Catch-up hold (internal/catchup gate.go): catch-up's admissions wait
	// while this host's bridge sheds or its engine queue fills.
	CatchupHoldState        prometheus.Gauge
	CatchupHeld             *prometheus.CounterVec
	CatchupHeldSeconds      *prometheus.CounterVec
	CatchupHoldMaxed        prometheus.Counter
	CatchupHoldSignalErrors prometheus.Counter
	CatchupBridgeFill       prometheus.Gauge
}

Metrics holds every family. Create it with New.

func New

func New(topics []string) *Metrics

New builds the registry. topics are the topics the host carries, so their per-topic series exist at zero from the start.

func (*Metrics) ObserveStages

func (m *Metrics) ObserveStages(s *Stages, module string)

ObserveStages records every stage that ran, under the submission's module.

func (*Metrics) PresetGASP added in v0.7.0

func (m *Metrics) PresetGASP(peers, topics []string)

PresetGASP creates the catch-up series of every peer and every topic GASP carries at zero, so an alert or a rate reads them before the first event.

func (*Metrics) PresetModules added in v0.6.0

func (m *Metrics) PresetModules(modules []string)

PresetModules creates the stage and admission series of every mounted module at zero (and of multi, when more than one is mounted), so a module that has admitted nothing yet shows zero rather than no series. The host calls it once the modules are mounted.

func (*Metrics) PresetPrune added in v0.12.0

func (m *Metrics) PresetPrune(topics []string)

PresetPrune creates the anytx retention's per-topic series.

func (*Metrics) PresetReplay added in v0.9.0

func (m *Metrics) PresetReplay(peers, topics []string)

PresetReplay creates the replay series of every peer and every topic a module repairs by replay.

type Stage

type Stage int

Stage is one step of an admission, a label value of overlay_go_admission_stage_seconds.

const (
	StageParse   Stage = iota // BEEF bytes to a transaction graph
	StageMerkle               // merkle roots and the tip, asked of the chain tracker
	StageScripts              // everything else SPV does: scripts, amounts, structure
	StageFee                  // the subject's fee against the configured floor
	StageLock                 // waiting for the submission's topic locks
	StageAdmit                // topic managers' IdentifyAdmissibleOutputs, all topics
	StagePayload              // the BEEF blob write
	StageCommit               // the index writes
	StageNotify               // lookup services told of admitted and spent outputs

)

The stages, in the order an admission runs them.

func (Stage) String

func (s Stage) String() string

type Stages

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

Stages accumulates stage durations for one submission. Code that runs inside the engine (topic managers, storage) finds it in the context and adds to it; the pipeline observes the totals once, so a stage that runs several times per object (a payload per admitted output) is one sample.

func StagesFrom

func StagesFrom(ctx context.Context) *Stages

StagesFrom returns the accumulator in ctx, or nil.

func WithStages

func WithStages(ctx context.Context) (context.Context, *Stages)

WithStages returns a context carrying a fresh accumulator.

func (*Stages) Add

func (s *Stages) Add(stage Stage, d time.Duration)

Add adds d to stage. A nil receiver does nothing, so callers need not check.

func (*Stages) Get

func (s *Stages) Get(stage Stage) (time.Duration, bool)

Get returns a stage's total and whether it ran.

Jump to

Keyboard shortcuts

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