metrics

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 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"}
	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.

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

	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

	// 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
}

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.

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