Documentation
¶
Index ¶
- Constants
- type CacheMetrics
- type Metrics
- func (m *Metrics) RecordInfo(version string)
- func (m *Metrics) RecordPipelineReset()
- 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) RecordUp()
- func (m *Metrics) Serve(ctx context.Context, hostname string, port int) error
- func (m *Metrics) SetDerivationIdle(status bool)
- func (m *Metrics) SetHead(kind string, num uint64)
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 NewCacheMetrics(registry prometheus.Registerer, ns string, name string, displayName string) *CacheMetrics
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 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 DerivationIdle prometheus.Gauge PipelineResetsTotal prometheus.Counter LastPipelineResetUnix prometheus.Gauge UnsafePayloadsTotal prometheus.Counter DerivationErrorsTotal prometheus.Counter SequencingErrorsTotal prometheus.Counter PublishingErrorsTotal prometheus.Counter Heads *prometheus.GaugeVec TransactionsSequencedTotal prometheus.Counter // contains filtered or unexported fields }
func NewMetrics ¶
func (*Metrics) RecordInfo ¶
RecordInfo sets a pseudo-metric that contains versioning and config info for the opnode.
func (*Metrics) RecordPipelineReset ¶
func (m *Metrics) RecordPipelineReset()
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) Serve ¶
Serve starts the metrics server on the given hostname and port. The server will be closed when the passed-in context is cancelled.