metrics

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 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 (
	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

This section is empty.

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
}

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)

ObserveStages records every stage that ran.

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
	StageAdmit                // topic managers' IdentifyAdmissibleOutputs, all topics
	StagePayload              // the BEEF blob write
	StageCommit               // the index writes

)

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