Documentation ¶
Index ¶
- Constants
- Variables
- func CLIFlags(envPrefix string) []cli.Flag
- func LaunchBalanceMetrics(ctx context.Context, log log.Logger, r *prometheus.Registry, ns string, ...)
- func ListenAndServe(ctx context.Context, r *prometheus.Registry, hostname string, port int) error
- func NewHTTPRecordingMiddleware(rec HTTPRecorder, next http.Handler) http.Handler
- func NewRegistry() *prometheus.Registry
- type CLIConfig
- type DocumentedMetric
- type Event
- type EventVec
- type Factory
- type HTTPParams
- type HTTPRecorder
- type NodeRecorder
- type NoopRefMetrics
- type PromHTTPRecorder
- func (p *PromHTTPRecorder) RecordHTTPRequest(params *HTTPParams)
- func (p *PromHTTPRecorder) RecordHTTPRequestDuration(params *HTTPParams, dur time.Duration)
- func (p *PromHTTPRecorder) RecordHTTPResponse(params *HTTPParams)
- func (p *PromHTTPRecorder) RecordHTTPResponseSize(params *HTTPParams, size int)
- func (p *PromHTTPRecorder) RecordInflightRequest(params *HTTPParams, quantity int)
- type PromNodeRecorder
- type RefMetricer
- type RefMetrics
Constants ¶
const ( EnabledFlagName = "metrics.enabled" ListenAddrFlagName = "metrics.addr" PortFlagName = "metrics.port" )
Variables ¶
var NoopHTTPRecorder = new(noopHTTPRecorder)
var NoopNodeRecorder = new(noopNodeRecorder)
Functions ¶
func LaunchBalanceMetrics ¶
func LaunchBalanceMetrics(ctx context.Context, log log.Logger, r *prometheus.Registry, ns string, client *ethclient.Client, account common.Address)
LaunchBalanceMetrics fires off a go rountine that queries the balance of the supplied account & periodically records it to the balance metric of the namespace. The balance of the account is recorded in Ether (not Wei). Cancel the supplied context to shut down the go routine
func ListenAndServe ¶
func NewHTTPRecordingMiddleware ¶
func NewHTTPRecordingMiddleware(rec HTTPRecorder, next http.Handler) http.Handler
func NewRegistry ¶
func NewRegistry() *prometheus.Registry
Types ¶
type DocumentedMetric ¶
type Event ¶
type Event struct { Total prometheus.Counter LastTime prometheus.Gauge }
type EventVec ¶
type EventVec struct { Total prometheus.CounterVec LastTime prometheus.GaugeVec }
func NewEventVec ¶
type Factory ¶
type Factory interface { NewCounter(opts prometheus.CounterOpts) prometheus.Counter NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec NewSummary(opts prometheus.SummaryOpts) prometheus.Summary NewSummaryVec(opts prometheus.SummaryOpts, labelNames []string) *prometheus.SummaryVec Document() []DocumentedMetric }
func With ¶
func With(registry *prometheus.Registry) Factory
type HTTPParams ¶
type HTTPRecorder ¶
type HTTPRecorder interface { RecordHTTPRequestDuration(params *HTTPParams, dur time.Duration) RecordHTTPResponseSize(params *HTTPParams, size int) RecordInflightRequest(params *HTTPParams, quantity int) RecordHTTPRequest(params *HTTPParams) RecordHTTPResponse(params *HTTPParams) }
func NewPromHTTPRecorder ¶
func NewPromHTTPRecorder(r *prometheus.Registry, ns string) HTTPRecorder
type NodeRecorder ¶
type NodeRecorder interface { RecordUp() RecordInfo(version string) }
func NewPromNodeRecorder ¶
func NewPromNodeRecorder(r *prometheus.Registry, ns string) NodeRecorder
type NoopRefMetrics ¶
type NoopRefMetrics struct{}
NoopRefMetrics can be embedded in a noop version of a metric implementation to have a noop RefMetricer.
func (*NoopRefMetrics) RecordL1Ref ¶
func (*NoopRefMetrics) RecordL1Ref(string, eth.L1BlockRef)
func (*NoopRefMetrics) RecordL2Ref ¶
func (*NoopRefMetrics) RecordL2Ref(string, eth.L2BlockRef)
type PromHTTPRecorder ¶
type PromHTTPRecorder struct { HTTPRequestDuration *prometheus.HistogramVec HTTPResponseSize *prometheus.HistogramVec HTTPInflightRequests *prometheus.GaugeVec HTTPRequests *prometheus.CounterVec HTTPResponses *prometheus.CounterVec }
func (*PromHTTPRecorder) RecordHTTPRequest ¶
func (p *PromHTTPRecorder) RecordHTTPRequest(params *HTTPParams)
func (*PromHTTPRecorder) RecordHTTPRequestDuration ¶
func (p *PromHTTPRecorder) RecordHTTPRequestDuration(params *HTTPParams, dur time.Duration)
func (*PromHTTPRecorder) RecordHTTPResponse ¶
func (p *PromHTTPRecorder) RecordHTTPResponse(params *HTTPParams)
func (*PromHTTPRecorder) RecordHTTPResponseSize ¶
func (p *PromHTTPRecorder) RecordHTTPResponseSize(params *HTTPParams, size int)
func (*PromHTTPRecorder) RecordInflightRequest ¶
func (p *PromHTTPRecorder) RecordInflightRequest(params *HTTPParams, quantity int)
type PromNodeRecorder ¶
type PromNodeRecorder struct { Up prometheus.Gauge Info *prometheus.GaugeVec }
func (*PromNodeRecorder) RecordInfo ¶
func (p *PromNodeRecorder) RecordInfo(version string)
func (*PromNodeRecorder) RecordUp ¶
func (p *PromNodeRecorder) RecordUp()
type RefMetricer ¶
type RefMetrics ¶
type RefMetrics struct { 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 }
RefMetrics provides block reference metrics. It's a metrics module that's supposed to be embedded into a service metrics type. The service metrics type should set the full namespace and create the factory before calling NewRefMetrics.
func MakeRefMetrics ¶
func MakeRefMetrics(ns string, factory Factory) RefMetrics
MakeRefMetrics returns a new RefMetrics, initializing its prometheus fields using factory. It is supposed to be used inside the construtors of metrics structs for any op service after the full namespace and factory have been setup.
ns is the fully qualified namespace, e.g. "pt_node_default".
func (*RefMetrics) RecordL1Ref ¶
func (m *RefMetrics) RecordL1Ref(name string, ref eth.L1BlockRef)
func (*RefMetrics) RecordL2Ref ¶
func (m *RefMetrics) RecordL2Ref(name string, ref eth.L2BlockRef)