Documentation
¶
Overview ¶
Package metrics provides a set of metrics for the op-node.
Index ¶
- Constants
- type CacheMetrics
- type EventMetrics
- type Metricer
- type Metrics
- func (m *Metrics) CountSequencedTxs(count int)
- func (m *Metrics) DecPeerCount()
- func (m *Metrics) DecStreamCount()
- func (m *Metrics) Document() []metrics.DocumentedMetric
- func (m *Metrics) IncPeerCount()
- func (m *Metrics) IncStreamCount()
- func (m *Metrics) RecordBandwidth(ctx context.Context, bwc *libp2pmetrics.BandwidthCounter)
- func (m *Metrics) RecordDerivationError()
- func (m *Metrics) RecordGossipEvent(evType int32)
- func (m *Metrics) RecordInfo(version string)
- func (m *Metrics) RecordL1Ref(name string, ref eth.L1BlockRef)
- func (m *Metrics) RecordL1ReorgDepth(d uint64)
- func (m *Metrics) RecordL2Ref(name string, ref eth.L2BlockRef)
- func (m *Metrics) RecordPipelineReset()
- func (m *Metrics) RecordPublishingError()
- func (m *Metrics) RecordRPCClientRequest(method string) func(err error)
- func (m *Metrics) RecordRPCClientResponse(method string, err error)
- func (m *Metrics) RecordRPCServerRequest(method string) func()
- func (m *Metrics) RecordReceivedUnsafePayload(payload *eth.ExecutionPayload)
- func (m *Metrics) RecordSequencerBuildingDiffTime(duration time.Duration)
- func (m *Metrics) RecordSequencerSealingTime(duration time.Duration)
- func (m *Metrics) RecordSequencingError()
- func (m *Metrics) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)
- func (m *Metrics) RecordUp()
- func (m *Metrics) Serve(ctx context.Context, hostname string, port int) error
- func (m *Metrics) SetDerivationIdle(status bool)
Constants ¶
const ( Namespace = "op_node" RPCServerSubsystem = "rpc_server" RPCClientSubsystem = "rpc_client" BatchMethod = "<batch>" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheMetrics ¶
type CacheMetrics struct {
SizeVec *prometheus.GaugeVec
GetVec *prometheus.CounterVec
AddVec *prometheus.CounterVec
}
CacheMetrics implements the Metrics interface in the caching package, implementing reusable metrics for different caches.
func NewCacheMetrics ¶
func (*CacheMetrics) CacheAdd ¶
func (m *CacheMetrics) CacheAdd(typeLabel string, typeCacheSize int, evicted bool)
CacheAdd meters the addition of an item with a given type to the cache, metering the change of the cache size of that type, and indicating a corresponding eviction if any.
func (*CacheMetrics) CacheGet ¶
func (m *CacheMetrics) CacheGet(typeLabel string, hit bool)
CacheGet meters a lookup of an item with a given type to the cache and indicating if the lookup was a hit.
type EventMetrics ¶
type EventMetrics struct {
Total prometheus.Counter
LastTime prometheus.Gauge
}
func NewEventMetrics ¶
func (*EventMetrics) RecordEvent ¶
func (e *EventMetrics) RecordEvent()
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.ExecutionPayload)
RecordL1Ref(name string, ref eth.L1BlockRef)
RecordL2Ref(name string, ref eth.L2BlockRef)
RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)
CountSequencedTxs(count int)
RecordL1ReorgDepth(d uint64)
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
// contains filtered or unexported methods
}
type Metrics ¶
type Metrics struct {
Info *prometheus.GaugeVec
Up prometheus.Gauge
RPCServerRequestsTotal *prometheus.CounterVec
RPCServerRequestDurationSeconds *prometheus.HistogramVec
RPCClientRequestsTotal *prometheus.CounterVec
RPCClientRequestDurationSeconds *prometheus.HistogramVec
RPCClientResponsesTotal *prometheus.CounterVec
L1SourceCache *CacheMetrics
L2SourceCache *CacheMetrics
DerivationIdle prometheus.Gauge
PipelineResets *EventMetrics
UnsafePayloads *EventMetrics
DerivationErrors *EventMetrics
SequencingErrors *EventMetrics
PublishingErrors *EventMetrics
SequencerBuildingDiffDurationSeconds prometheus.Histogram
SequencerBuildingDiffTotal prometheus.Counter
SequencerSealingDurationSeconds prometheus.Histogram
SequencerSealingTotal prometheus.Counter
UnsafePayloadsBufferLen prometheus.Gauge
UnsafePayloadsBufferMemSize prometheus.Gauge
RefsNumber *prometheus.GaugeVec
RefsTime *prometheus.GaugeVec
RefsHash *prometheus.GaugeVec
RefsSeqNr *prometheus.GaugeVec
RefsLatency *prometheus.GaugeVec
// hash of the last seen block per name, so we don't reduce/increase latency on updates of the same data,
// and only count the first occurrence
LatencySeen map[string]common.Hash
L1ReorgDepth prometheus.Histogram
TransactionsSequencedTotal prometheus.Counter
// P2P Metrics
PeerCount prometheus.Gauge
StreamCount prometheus.Gauge
GossipEventsTotal *prometheus.CounterVec
BandwidthTotal *prometheus.GaugeVec
// contains filtered or unexported fields
}
Metrics tracks all the metrics for the op-node.
func NewMetrics ¶
NewMetrics creates a new Metrics instance with the given process name.
func (*Metrics) CountSequencedTxs ¶
func (*Metrics) DecPeerCount ¶
func (m *Metrics) DecPeerCount()
func (*Metrics) DecStreamCount ¶
func (m *Metrics) DecStreamCount()
func (*Metrics) Document ¶ added in v0.10.11
func (m *Metrics) Document() []metrics.DocumentedMetric
func (*Metrics) IncPeerCount ¶
func (m *Metrics) IncPeerCount()
func (*Metrics) IncStreamCount ¶
func (m *Metrics) IncStreamCount()
func (*Metrics) RecordBandwidth ¶
func (m *Metrics) RecordBandwidth(ctx context.Context, bwc *libp2pmetrics.BandwidthCounter)
func (*Metrics) RecordDerivationError ¶
func (m *Metrics) RecordDerivationError()
func (*Metrics) RecordGossipEvent ¶
func (*Metrics) RecordInfo ¶
RecordInfo sets a pseudo-metric that contains versioning and config info for the opnode.
func (*Metrics) RecordL1Ref ¶
func (m *Metrics) RecordL1Ref(name string, ref eth.L1BlockRef)
func (*Metrics) RecordL1ReorgDepth ¶
func (*Metrics) RecordL2Ref ¶
func (m *Metrics) RecordL2Ref(name string, ref eth.L2BlockRef)
func (*Metrics) RecordPipelineReset ¶
func (m *Metrics) RecordPipelineReset()
func (*Metrics) RecordPublishingError ¶
func (m *Metrics) RecordPublishingError()
func (*Metrics) RecordRPCClientRequest ¶
RecordRPCClientRequest is a helper method to record an RPC client request. It bumps the requests metric, tracks the response duration, and records the response's error code.
func (*Metrics) RecordRPCClientResponse ¶
RecordRPCClientResponse records an RPC response. It will convert the passed-in error into something metrics friendly. Nil errors get converted into <nil>, RPC errors are converted into rpc_<error code>, HTTP errors are converted into http_<status code>, and everything else is converted into <unknown>.
func (*Metrics) RecordRPCServerRequest ¶
RecordRPCServerRequest is a helper method to record an incoming RPC call to the opnode's RPC server. It bumps the requests metric, and tracks how long it takes to serve a response.
func (*Metrics) RecordReceivedUnsafePayload ¶
func (m *Metrics) RecordReceivedUnsafePayload(payload *eth.ExecutionPayload)
func (*Metrics) RecordSequencerBuildingDiffTime ¶ added in v0.10.4
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) RecordSequencerSealingTime ¶ added in v0.10.4
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 (*Metrics) Serve ¶
Serve starts the metrics server on the given hostname and port. The server will be closed when the passed-in context is cancelled.