metrics

package
v1.5.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT, MIT Imports: 15 Imported by: 14

Documentation

Overview

Package metrics provides a set of metrics for the op-node.

Index

Constants

View Source
const (
	Namespace = "op_node"

	BatchMethod = "<batch>"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Metricer

type Metricer interface {
	RecordInfo(version string)
	RecordUp()
	RecordRPCServerRequest(method string) func()
	RecordRPCClientRequest(method string) func(err error)
	RecordRPCClientResponse(method string, err error)
	SetDerivationIdle(status bool)
	RecordPipelineReset()
	RecordSequencingError()
	RecordPublishingError()
	RecordDerivationError()
	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)
	CountSequencedTxs(count 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)
	ClientPayloadByNumberEvent(num uint64, resultCode byte, duration time.Duration)
	ServerPayloadByNumberEvent(num uint64, resultCode byte, duration time.Duration)
	PayloadsQuarantineSize(n int)
	RecordPeerUnban()
	RecordIPUnban()
	RecordDial(allow bool)
	RecordAccept(allow bool)
	ReportProtocolVersions(local, engine, recommended, required params.ProtocolVersion)
}
var NoopMetrics Metricer = new(noopMetricer)

type Metrics

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

	metrics.RPCMetrics

	L1SourceCache *metrics.CacheMetrics
	L2SourceCache *metrics.CacheMetrics

	DerivationIdle prometheus.Gauge

	PipelineResets   *metrics.Event
	UnsafePayloads   *metrics.Event
	DerivationErrors *metrics.Event
	SequencingErrors *metrics.Event
	PublishingErrors *metrics.Event

	DerivedBatches metrics.EventVec

	P2PReqDurationSeconds *prometheus.HistogramVec
	P2PReqTotal           *prometheus.CounterVec
	P2PPayloadByNumber    *prometheus.GaugeVec

	PayloadsQuarantineTotal prometheus.Gauge

	SequencerInconsistentL1Origin *metrics.Event
	SequencerResets               *metrics.Event

	L1RequestDurationSeconds *prometheus.HistogramVec

	SequencerBuildingDiffDurationSeconds prometheus.Histogram
	SequencerBuildingDiffTotal           prometheus.Counter

	SequencerSealingDurationSeconds prometheus.Histogram
	SequencerSealingTotal           prometheus.Counter

	UnsafePayloadsBufferLen     prometheus.Gauge
	UnsafePayloadsBufferMemSize prometheus.Gauge

	metrics.RefMetrics

	L1ReorgDepth prometheus.Histogram

	TransactionsSequencedTotal prometheus.Counter

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

	// Protocol version reporting
	// Delta = params.ProtocolVersionComparison
	ProtocolVersionDelta *prometheus.GaugeVec
	// ProtocolVersions is pseudo-metric to report the exact protocol version info
	ProtocolVersions *prometheus.GaugeVec
	// contains filtered or unexported fields
}

Metrics tracks all the metrics for the op-node.

func NewMetrics

func NewMetrics(procName string) *Metrics

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

func (*Metrics) ClientPayloadByNumberEvent added in v1.0.3

func (m *Metrics) ClientPayloadByNumberEvent(num uint64, resultCode byte, duration time.Duration)

func (*Metrics) CountSequencedTxs

func (m *Metrics) CountSequencedTxs(count 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) PayloadsQuarantineSize added in v1.0.3

func (m *Metrics) PayloadsQuarantineSize(n int)

func (*Metrics) RecordAccept added in v1.1.2

func (m *Metrics) RecordAccept(allow bool)

func (*Metrics) RecordBandwidth

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

func (*Metrics) RecordChannelInputBytes added in v1.0.3

func (m *Metrics) RecordChannelInputBytes(inputCompressedBytes int)

func (*Metrics) RecordChannelTimedOut added in v1.1.4

func (m *Metrics) RecordChannelTimedOut()

func (*Metrics) RecordDerivationError

func (m *Metrics) RecordDerivationError()

func (*Metrics) RecordDerivedBatches added in v1.4.2

func (m *Metrics) RecordDerivedBatches(batchType string)

func (*Metrics) RecordDial added in v1.1.2

func (m *Metrics) RecordDial(allow bool)

func (*Metrics) RecordFrame added in v1.1.4

func (m *Metrics) RecordFrame()

func (*Metrics) RecordGossipEvent

func (m *Metrics) RecordGossipEvent(evType int32)

func (*Metrics) RecordHeadChannelOpened added in v1.1.4

func (m *Metrics) RecordHeadChannelOpened()

func (*Metrics) RecordIPUnban added in v1.1.2

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 added in v1.0.8

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 added in v1.1.2

func (m *Metrics) RecordPeerUnban()

func (*Metrics) RecordPipelineReset

func (m *Metrics) RecordPipelineReset()

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) 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) 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) ReportProtocolVersions added in v1.1.6

func (m *Metrics) ReportProtocolVersions(local, engine, recommended, required params.ProtocolVersion)

func (*Metrics) ServerPayloadByNumberEvent added in v1.0.3

func (m *Metrics) ServerPayloadByNumberEvent(num uint64, resultCode byte, duration time.Duration)

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) StartServer added in v1.4.2

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

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

Jump to

Keyboard shortcuts

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