metrics

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	StageLoaded         = "loaded"
	StageOpened         = "opened"
	StageAdded          = "added"
	StageClosed         = "closed"
	StageFullySubmitted = "fully_submitted"
	StageTimedOut       = "timed_out"

	TxStageSubmitted = "submitted"
	TxStageSuccess   = "success"
	TxStageFailed    = "failed"
)
View Source
const Namespace = "op_batcher"

Variables

This section is empty.

Functions

func ClosedReasonToNum

func ClosedReasonToNum(reason error) int

Types

type Metricer

type Metricer interface {
	RecordInfo(version string)
	RecordUp()

	// Records all L1 and L2 block events
	opmetrics.RefMetricer

	RecordLatestL1Block(l1ref eth.L1BlockRef)
	RecordL2BlocksLoaded(l2ref eth.L2BlockRef)
	RecordChannelOpened(id derive.ChannelID, numPendingBlocks int)
	RecordL2BlocksAdded(l2ref eth.L2BlockRef, numBlocksAdded, numPendingBlocks, inputBytes, outputComprBytes int)
	RecordChannelClosed(id derive.ChannelID, numPendingBlocks int, numFrames int, inputBytes int, outputComprBytes int, reason error)
	RecordChannelFullySubmitted(id derive.ChannelID)
	RecordChannelTimedOut(id derive.ChannelID)

	RecordBatchTxSubmitted()
	RecordBatchTxSuccess()
	RecordBatchTxFailed()

	Document() []opmetrics.DocumentedMetric
}
var NoopMetrics Metricer = new(noopMetrics)

type Metrics

type Metrics struct {
	opmetrics.RefMetrics

	Info prometheus.GaugeVec
	Up   prometheus.Gauge

	// label by openend, closed, fully_submitted, timed_out
	ChannelEvs opmetrics.EventVec

	PendingBlocksCount prometheus.GaugeVec
	BlocksAddedCount   prometheus.Gauge

	ChannelInputBytes   prometheus.GaugeVec
	ChannelReadyBytes   prometheus.Gauge
	ChannelOutputBytes  prometheus.Gauge
	ChannelClosedReason prometheus.Gauge
	ChannelNumFrames    prometheus.Gauge
	ChannelComprRatio   prometheus.Histogram

	BatcherTxEvs opmetrics.EventVec
	// contains filtered or unexported fields
}

func NewMetrics

func NewMetrics(procName string) *Metrics

func (*Metrics) Document

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

func (*Metrics) RecordBatchTxFailed

func (m *Metrics) RecordBatchTxFailed()

func (*Metrics) RecordBatchTxSubmitted

func (m *Metrics) RecordBatchTxSubmitted()

func (*Metrics) RecordBatchTxSuccess

func (m *Metrics) RecordBatchTxSuccess()

func (*Metrics) RecordChannelClosed

func (m *Metrics) RecordChannelClosed(id derive.ChannelID, numPendingBlocks int, numFrames int, inputBytes int, outputComprBytes int, reason error)

func (*Metrics) RecordChannelFullySubmitted

func (m *Metrics) RecordChannelFullySubmitted(id derive.ChannelID)

func (*Metrics) RecordChannelOpened

func (m *Metrics) RecordChannelOpened(id derive.ChannelID, numPendingBlocks int)

func (*Metrics) RecordChannelTimedOut

func (m *Metrics) RecordChannelTimedOut(id derive.ChannelID)

func (*Metrics) RecordInfo

func (m *Metrics) RecordInfo(version string)

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

func (*Metrics) RecordL2BlocksAdded

func (m *Metrics) RecordL2BlocksAdded(l2ref eth.L2BlockRef, numBlocksAdded, numPendingBlocks, inputBytes, outputComprBytes int)

RecordL2BlocksAdded should be called when L2 block were added to the channel builder, with the latest added block.

func (*Metrics) RecordL2BlocksLoaded

func (m *Metrics) RecordL2BlocksLoaded(l2ref eth.L2BlockRef)

RecordL2BlocksLoaded should be called when a new L2 block was loaded into the channel manager (but not processed yet).

func (*Metrics) RecordLatestL1Block

func (m *Metrics) RecordLatestL1Block(l1ref eth.L1BlockRef)

func (*Metrics) RecordUp

func (m *Metrics) RecordUp()

RecordUp sets the up metric to 1.

func (*Metrics) Serve

func (m *Metrics) Serve(ctx context.Context, host string, port int) error

func (*Metrics) StartBalanceMetrics

func (m *Metrics) StartBalanceMetrics(ctx context.Context,
	l log.Logger, client *ethclient.Client, account common.Address)

Jump to

Keyboard shortcuts

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