metrics

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 7 Imported by: ? 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 defines the reporter's Prometheus collectors and serves them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, lis net.Listener, g prometheus.Gatherer) error

Serve exposes g at /metrics on lis until ctx is cancelled, then shuts down gracefully. It closes lis before it returns.

Types

type Metrics

type Metrics struct {
	PassDuration     prometheus.Histogram
	PassTransfers    prometheus.Gauge
	Reviews          *prometheus.CounterVec
	Alerts           *prometheus.CounterVec
	RPCDuration      *prometheus.HistogramVec
	RPCErrors        *prometheus.CounterVec
	CacheRequests    *prometheus.CounterVec
	Tx               *prometheus.CounterVec
	TxMessages       *prometheus.CounterVec
	TxFeesUakt       prometheus.Counter
	TxInFlight       prometheus.Gauge
	DeferredMessages *prometheus.CounterVec
}

Metrics holds the collectors of spec section 9.3. Every method is safe on a nil *Metrics and records nothing.

func New

func New(reg prometheus.Registerer) *Metrics

New creates the collectors and registers them with reg.

func (*Metrics) AddTxFees

func (m *Metrics) AddTxFees(uakt float64)

AddTxFees adds fees paid, in uakt.

func (*Metrics) AddTxInFlight

func (m *Metrics) AddTxInFlight(delta float64)

AddTxInFlight changes the number of transactions awaiting confirmation by delta.

func (*Metrics) ObservePass

func (m *Metrics) ObservePass(d time.Duration, transfers int)

ObservePass records a finished pass and the number of transfers it reviewed.

func (*Metrics) RecordAlert

func (m *Metrics) RecordAlert(alert string)

RecordAlert counts an alert of the given kind.

func (*Metrics) RecordCache

func (m *Metrics) RecordCache(cache string, hit bool)

RecordCache counts a lookup in the named cache as a hit or a miss.

func (*Metrics) RecordDeferred

func (m *Metrics) RecordDeferred(reason string)

RecordDeferred counts a deferred message with reason slot_busy, slot_full, cutoff, simulation or cap.

func (*Metrics) RecordRPC

func (m *Metrics) RecordRPC(chain, method string, d time.Duration, err error)

RecordRPC records an RPC call on chain "akash" or "solana"; a non-nil err also counts as an error.

func (*Metrics) RecordReview

func (m *Metrics) RecordReview(result string)

RecordReview counts a review with result "ok" or "error".

func (*Metrics) RecordTx

func (m *Metrics) RecordTx(result string)

RecordTx counts a transaction with result included, failed, rejected, slot_taken, expired or unconfirmed.

func (*Metrics) RecordTxMessage

func (m *Metrics) RecordTxMessage(msgType string)

RecordTxMessage counts a message sent in a transaction.

Jump to

Keyboard shortcuts

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