metrics

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT, MIT Imports: 17 Imported by: 10 modules, 15 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 provides a set of metrics for the op-node.

Index

Constants

View Source
const Namespace = "op_node"

Variables

This section is empty.

Functions

This section is empty.

Types

type Metricer

type Metricer interface {
	RecordInfo(version string)
	RecordHardforkActivationTimes(cfg *rollup.Config)
	RecordUp()
	SetDerivationIdle(status bool)
	SetSequencerState(active bool)
	RecordPipelineReset()
	RecordFollowSourceRequest(result string)
	RecordFollowSourceReorg(action string)
	RecordSuperAuthorityReorgSignal(reason string)
	RecordSequencingError()
	RecordPublishingError()
	RecordDroppedPublish()
	RecordSequencerInsertTime(stage string, duration time.Duration)
	RecordSequencerPublishHandoff(duration time.Duration)
	RecordPublishQueueLen(length int)
	RecordPublishDelay(duration time.Duration)
	RecordDerivationError()
	RecordEmittedEvent(eventName string, emitter string)
	RecordProcessedEvent(eventName string, deriver string, duration time.Duration)
	RecordEventsRateLimited()
	RecordReceivedUnsafePayload(payload *eth.ExecutionPayloadEnvelope)
	RecordRef(layer string, name string, num uint64, timestamp uint64, h common.Hash)
	RecordL1Ref(name string, ref eth.L1BlockRef)
	RecordL2Ref(name string, ref eth.L2BlockRef)
	RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)
	RecordDerivedBatches(batchType string)
	CountSequencedTxsInBlock(txns int, deposits int)
	RecordL1ReorgDepth(d uint64)
	RecordSequencerInconsistentL1Origin(from eth.BlockID, to eth.BlockID)
	RecordSequencerReset()
	RecordGossipEvent(evType int32)
	IncPeerCount()
	DecPeerCount()
	IncStreamCount()
	DecStreamCount()
	RecordBandwidth(ctx context.Context, bwc *libp2pmetrics.BandwidthCounter)
	RecordSequencerBuildingDiffTime(duration time.Duration)
	RecordSequencerSealingTime(duration time.Duration)
	Document() []metrics.DocumentedMetric
	RecordChannelInputBytes(num int)
	RecordHeadChannelOpened()
	RecordChannelTimedOut()
	RecordFrame()
	// P2P Metrics
	SetPeerScores(allScores []store.PeerScores)
	RecordPeerUnban()
	RecordIPUnban()
	RecordDial(allow bool)
	RecordAccept(allow bool)
}
var NoopMetrics Metricer = new(noopMetricer)

type Metrics

type Metrics struct {
	Info                   *prometheus.GaugeVec
	Up                     prometheus.Gauge
	HardforkActivationTime *prometheus.GaugeVec

	metrics.RPCMetrics

	L1SourceCache *metrics.CacheMetrics
	L2SourceCache *metrics.CacheMetrics

	L2FollowSourceCache        *metrics.CacheMetrics
	FollowSourceRequests       *prometheus.CounterVec
	FollowSourceReorgs         *prometheus.CounterVec
	SuperAuthorityReorgSignals *prometheus.CounterVec

	DerivationIdle prometheus.Gauge

	PipelineResets   *metrics.Event
	UnsafePayloads   *metrics.Event
	DerivationErrors *metrics.Event
	SequencingErrors *metrics.Event
	PublishingErrors *metrics.Event
	DroppedPublishes *metrics.Event
	SequencerActive  prometheus.Gauge

	*event.EventMetricsTracker

	DerivedBatches metrics.EventVec

	SequencerInconsistentL1Origin *metrics.Event
	SequencerResets               *metrics.Event

	L1RequestDurationSeconds *prometheus.HistogramVec

	SequencerBuildingDiffDurationSeconds prometheus.Histogram
	SequencerBuildingDiffTotal           prometheus.Counter

	SequencerSealingDurationSeconds prometheus.Histogram

	// SequencerInsertDurationSeconds splits the sequencer's block insert by engine
	// call, so the two candidate publish points can be priced independently: a
	// publish after newPayload pays only "newpayload", one after the whole insert
	// pays "total".
	SequencerInsertDurationSeconds *prometheus.HistogramVec
	// SequencerPublishHandoffSeconds is how long the sequencer's own goroutine
	// spends handing a sealed block to the publisher. It must stay near zero: this
	// is the hot path, and time spent here comes out of the next block's build
	// window.
	SequencerPublishHandoffSeconds prometheus.Histogram
	// PublishQueueLen is the number of sealed blocks awaiting publication.
	PublishQueueLen prometheus.Gauge
	// PublishDelaySeconds is seal-to-published, the delay peers actually see.
	PublishDelaySeconds prometheus.Histogram
	// UnsafePayloadArrivalDelaySeconds is how far behind its own timestamp a
	// gossiped block arrives. Measured on the receiving node, this is the only
	// metric that shows what peers experience end to end.
	UnsafePayloadArrivalDelaySeconds prometheus.Histogram
	SequencerSealingTotal            prometheus.Counter

	UnsafePayloadsBufferLen     prometheus.Gauge
	UnsafePayloadsBufferMemSize prometheus.Gauge

	metrics.RefMetrics

	L1ReorgDepth prometheus.Histogram

	TransactionsSequencedTotal *prometheus.CounterVec

	AltDAMetrics altda.Metricer

	// P2P Metrics
	PeerCount         prometheus.Gauge
	StreamCount       prometheus.Gauge
	GossipEventsTotal *prometheus.CounterVec
	BandwidthTotal    *prometheus.GaugeVec
	PeerUnbans        prometheus.Counter
	IPUnbans          prometheus.Counter
	Dials             *prometheus.CounterVec
	Accepts           *prometheus.CounterVec
	PeerScores        *prometheus.HistogramVec

	ChannelInputBytes prometheus.Counter
	// contains filtered or unexported fields
}

Metrics tracks all the metrics for the op-node.

func NewMetrics

func NewMetrics(procName string, labels prometheus.Labels) *Metrics

NewMetrics creates a new Metrics instance with the given process name.

func (*Metrics) CountSequencedTxsInBlock

func (m *Metrics) CountSequencedTxsInBlock(txns int, deposits int)

func (*Metrics) DecPeerCount

func (m *Metrics) DecPeerCount()

func (*Metrics) DecStreamCount

func (m *Metrics) DecStreamCount()

func (*Metrics) Document

func (m *Metrics) Document() []metrics.DocumentedMetric

func (*Metrics) IncPeerCount

func (m *Metrics) IncPeerCount()

func (*Metrics) IncStreamCount

func (m *Metrics) IncStreamCount()

func (*Metrics) RecordAccept

func (m *Metrics) RecordAccept(allow bool)

func (*Metrics) RecordBandwidth

func (m *Metrics) RecordBandwidth(ctx context.Context, bwc *libp2pmetrics.BandwidthCounter)

func (*Metrics) RecordChannelInputBytes

func (m *Metrics) RecordChannelInputBytes(inputCompressedBytes int)

func (*Metrics) RecordChannelTimedOut

func (m *Metrics) RecordChannelTimedOut()

func (*Metrics) RecordDerivationError

func (m *Metrics) RecordDerivationError()

func (*Metrics) RecordDerivedBatches

func (m *Metrics) RecordDerivedBatches(batchType string)

func (*Metrics) RecordDial

func (m *Metrics) RecordDial(allow bool)

func (*Metrics) RecordDroppedPublish added in v1.19.10

func (m *Metrics) RecordDroppedPublish()

RecordDroppedPublish counts sealed blocks that never reached peers, whether evicted from a full publish queue or given up on after repeated failures. On publishing_errors alone a final failure is indistinguishable from a retried one.

func (*Metrics) RecordFollowSourceReorg added in v1.19.5

func (m *Metrics) RecordFollowSourceReorg(action string)

func (*Metrics) RecordFollowSourceRequest added in v1.19.0

func (m *Metrics) RecordFollowSourceRequest(result string)

func (*Metrics) RecordFrame

func (m *Metrics) RecordFrame()

func (*Metrics) RecordGossipEvent

func (m *Metrics) RecordGossipEvent(evType int32)

func (*Metrics) RecordHardforkActivationTimes added in v1.19.5

func (m *Metrics) RecordHardforkActivationTimes(cfg *rollup.Config)

func (*Metrics) RecordHeadChannelOpened

func (m *Metrics) RecordHeadChannelOpened()

func (*Metrics) RecordIPUnban

func (m *Metrics) RecordIPUnban()

func (*Metrics) RecordInfo

func (m *Metrics) RecordInfo(version string)

RecordInfo sets a pseudo-metric that contains versioning and config info for the opnode.

func (*Metrics) RecordL1ReorgDepth

func (m *Metrics) RecordL1ReorgDepth(d uint64)

func (*Metrics) RecordL1RequestTime

func (m *Metrics) RecordL1RequestTime(method string, duration time.Duration)

RecordL1RequestTime tracks the amount of time the derivation pipeline spent waiting for L1 data requests.

func (*Metrics) RecordPeerUnban

func (m *Metrics) RecordPeerUnban()

func (*Metrics) RecordPipelineReset

func (m *Metrics) RecordPipelineReset()

func (*Metrics) RecordPublishDelay added in v1.19.10

func (m *Metrics) RecordPublishDelay(duration time.Duration)

func (*Metrics) RecordPublishQueueLen added in v1.19.10

func (m *Metrics) RecordPublishQueueLen(length int)

func (*Metrics) RecordPublishingError

func (m *Metrics) RecordPublishingError()

func (*Metrics) RecordReceivedUnsafePayload

func (m *Metrics) RecordReceivedUnsafePayload(payload *eth.ExecutionPayloadEnvelope)

func (*Metrics) RecordSequencerBuildingDiffTime

func (m *Metrics) RecordSequencerBuildingDiffTime(duration time.Duration)

RecordSequencerBuildingDiffTime tracks the amount of time the sequencer was allowed between start to finish, incl. sealing, minus the block time. Ideally this is 0, realistically the sequencer scheduler may be busy with other jobs like syncing sometimes.

func (*Metrics) RecordSequencerInconsistentL1Origin

func (m *Metrics) RecordSequencerInconsistentL1Origin(from eth.BlockID, to eth.BlockID)

func (*Metrics) RecordSequencerInsertTime added in v1.19.10

func (m *Metrics) RecordSequencerInsertTime(stage string, duration time.Duration)

RecordSequencerInsertTime records one phase of a sequencer block insert. The stages are observed separately and "total" is observed in its own right: summing buckets across label values pools the observations rather than convolving the distributions, so it would not yield the p99 of the sum.

func (*Metrics) RecordSequencerPublishHandoff added in v1.19.10

func (m *Metrics) RecordSequencerPublishHandoff(duration time.Duration)

func (*Metrics) RecordSequencerReset

func (m *Metrics) RecordSequencerReset()

func (*Metrics) RecordSequencerSealingTime

func (m *Metrics) RecordSequencerSealingTime(duration time.Duration)

RecordSequencerSealingTime tracks the amount of time the sequencer took to finish sealing the block. Ideally this is 0, realistically it may take some time.

func (*Metrics) RecordSequencingError

func (m *Metrics) RecordSequencingError()

func (*Metrics) RecordSuperAuthorityReorgSignal added in v1.19.5

func (m *Metrics) RecordSuperAuthorityReorgSignal(reason string)

func (*Metrics) RecordUnsafePayloadsBuffer

func (m *Metrics) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)

func (*Metrics) RecordUp

func (m *Metrics) RecordUp()

RecordUp sets the up metric to 1.

func (*Metrics) Registry

func (m *Metrics) Registry() *prometheus.Registry

Registry returns the underlying Prometheus registry used by this metrics instance. This enables external services (e.g. a supervising process) to expose metrics without starting an internal HTTP server per node.

func (*Metrics) SetDerivationIdle

func (m *Metrics) SetDerivationIdle(status bool)

func (*Metrics) SetPeerScores

func (m *Metrics) SetPeerScores(allScores []store.PeerScores)

SetPeerScores updates the peer score metrics. Accepts a slice of peer scores in any order.

func (*Metrics) SetSequencerState

func (m *Metrics) SetSequencerState(active bool)

func (*Metrics) StartServer

func (m *Metrics) StartServer(hostname string, port int) (*ophttp.HTTPServer, error)

StartServer starts the metrics server on the given hostname and port.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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