resources

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsFanIn

type MetricsFanIn struct {
	// contains filtered or unexported fields
}

MetricsFanIn is an http.handler which allows multiple Prometheus metrics "Gatherers" to be combined and served at the /metrics path.

The Gatherers must not collide with each other, e.g. each must have a unique name or label set. This can be accomplished by using a distinct, global label on each Gatherer.

func NewMetricsFanIn

func NewMetricsFanIn(numGatherers int) *MetricsFanIn

func (*MetricsFanIn) AddGatherer added in v1.17.0

func (r *MetricsFanIn) AddGatherer(g prometheus.Gatherer)

AddGatherer registers an additional prometheus.Gatherer (e.g. SupernodeMetrics) to be served alongside per-chain metrics. Nil gatherers are ignored.

func (*MetricsFanIn) ServeHTTP

func (r *MetricsFanIn) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*MetricsFanIn) SetMetricsRegistry

func (r *MetricsFanIn) SetMetricsRegistry(key string, g prometheus.Gatherer)

type MetricsService

type MetricsService struct {
	// contains filtered or unexported fields
}

MetricsService encapsulates an HTTP server that serves the MetricsRouter.

func NewMetricsService

func NewMetricsService(log gethlog.Logger, listenAddr string, port int, handler http.Handler) *MetricsService

NewMetricsService constructs a metrics HTTP server bound to the given address/port using the provided handler.

func (*MetricsService) Start

func (s *MetricsService) Start(onDone func(), onError func(error))

Start begins serving metrics in a background goroutine. If the server exits with an error, the optional onError callback is invoked.

func (*MetricsService) Stop

func (s *MetricsService) Stop(ctx context.Context) error

Stop gracefully shuts down the metrics server.

type NonCloseableL1BeaconClient

type NonCloseableL1BeaconClient struct {
	*sources.L1BeaconClient
}

NonCloseableL1BeaconClient wraps an L1BeaconClient to prevent it from being closed. This is used when sharing a single beacon client across multiple virtual nodes.

func NewNonCloseableL1BeaconClient

func NewNonCloseableL1BeaconClient(client *sources.L1BeaconClient) *NonCloseableL1BeaconClient

NewNonCloseableL1BeaconClient wraps an L1BeaconClient to prevent closure. Returns nil if the input client is nil (beacon client is optional).

func (*NonCloseableL1BeaconClient) Close

func (c *NonCloseableL1BeaconClient) Close()

type NonCloseableL1Client

type NonCloseableL1Client struct {
	*sources.L1Client
}

NonCloseableL1Client wraps an L1Client to prevent it from being closed. This is used when sharing a single L1Client across multiple virtual nodes, where we don't want any individual node to close the shared resource.

func NewNonCloseableL1Client

func NewNonCloseableL1Client(client *sources.L1Client) *NonCloseableL1Client

NewNonCloseableL1Client wraps an L1Client to prevent closure.

func (*NonCloseableL1Client) Close

func (c *NonCloseableL1Client) Close()

Close is a no-op for the non-closeable wrapper. The underlying client should only be closed when the supernode itself shuts down.

type NonCloseableRPC

type NonCloseableRPC struct {
	client.RPC
}

NonCloseableRPC wraps an RPC client to prevent it from being closed. This is used when sharing a single RPC connection across multiple clients.

func NewNonCloseableRPC

func NewNonCloseableRPC(rpcClient client.RPC) *NonCloseableRPC

NewNonCloseableRPC wraps an RPC client to prevent closure.

func (*NonCloseableRPC) BatchCallContext

func (c *NonCloseableRPC) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error

BatchCallContext delegates to the underlying RPC client

func (*NonCloseableRPC) CallContext

func (c *NonCloseableRPC) CallContext(ctx context.Context, result any, method string, args ...any) error

CallContext delegates to the underlying RPC client

func (*NonCloseableRPC) Close

func (c *NonCloseableRPC) Close()

Close is a no-op for the non-closeable wrapper.

func (*NonCloseableRPC) Subscribe

func (c *NonCloseableRPC) Subscribe(ctx context.Context, namespace string, channel any, args ...any) (ethereum.Subscription, error)

Subscribe delegates to the underlying RPC client

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router multiplexes JSON-RPC requests by the first path segment which represents the chainID.

func NewRouter

func NewRouter(log gethlog.Logger, cfg RouterConfig) *Router

NewRouter constructs an empty Router. Handlers can be added later via SetHandler.

func (*Router) Close

func (r *Router) Close() error

Close releases any resources created by the factory.

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP routes requests to the chain-specific handler, after stripping the chain prefix.

func (*Router) SetHandler

func (r *Router) SetHandler(chainID string, h http.Handler)

SetHandler replaces or adds the handler for a given chainID at runtime.

func (*Router) SetRootHandler

func (r *Router) SetRootHandler(h http.Handler)

SetRootHandler sets the optional handler for '/'. If unset, '/' returns 404.

type RouterConfig

type RouterConfig struct {
	EnableWebsockets bool
	MaxBodyBytes     int64
}

RouterConfig defines runtime options for the RPC router server.

type SupernodeMetrics added in v1.17.0

type SupernodeMetrics struct {
	VNRestarts                  *prometheus.CounterVec
	InteropTimestampsVerified   prometheus.Counter
	InteropInvalidations        *prometheus.CounterVec
	InteropVerifiedTimestamp    prometheus.Gauge
	InteropRoundDecisions       *prometheus.CounterVec
	InteropRewinds              prometheus.Counter
	InteropVerificationDuration prometheus.Histogram
	ChainRewindDepthBlocks      *prometheus.HistogramVec
	DenyListEntries             *prometheus.CounterVec
	LogBackfillProgress         *prometheus.GaugeVec
	LogBackfillRetries          *prometheus.CounterVec
	ActivityErrors              *prometheus.CounterVec
	// contains filtered or unexported fields
}

SupernodeMetrics holds supernode-level metrics that outlive individual virtual node restarts. Created once in supernode.New() and shared with chain containers and activities. Callers that receive nil default to NewSupernodeMetrics(), which creates functional counters not attached to any scraped registry (safe for tests).

func NewSupernodeMetrics added in v1.17.0

func NewSupernodeMetrics() *SupernodeMetrics

NewSupernodeMetrics creates a new SupernodeMetrics backed by a dedicated registry.

func (*SupernodeMetrics) Registry added in v1.17.0

func (m *SupernodeMetrics) Registry() prometheus.Gatherer

Registry returns the prometheus gatherer for these metrics.

Jump to

Keyboard shortcuts

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