metrics

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 19 Imported by: 41

Documentation

Index

Constants

View Source
const (
	EnabledFlagName    = "metrics.enabled"
	ListenAddrFlagName = "metrics.addr"
	PortFlagName       = "metrics.port"
)

Variables

View Source
var NoopHTTPRecorder = new(noopHTTPRecorder)
View Source
var NoopNodeRecorder = new(noopNodeRecorder)

Functions

func CLIFlags

func CLIFlags(envPrefix string) []cli.Flag

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 ListenAndServe(ctx context.Context, r *prometheus.Registry, hostname string, port int) error

func NewHTTPRecordingMiddleware

func NewHTTPRecordingMiddleware(rec HTTPRecorder, next http.Handler) http.Handler

func NewRegistry

func NewRegistry() *prometheus.Registry

Types

type CLIConfig

type CLIConfig struct {
	Enabled    bool
	ListenAddr string
	ListenPort int
}

func ReadCLIConfig

func ReadCLIConfig(ctx *cli.Context) CLIConfig

func ReadLocalCLIConfig added in v0.10.4

func ReadLocalCLIConfig(ctx *cli.Context) CLIConfig

func (CLIConfig) Check

func (m CLIConfig) Check() error

type DocumentedMetric added in v0.10.11

type DocumentedMetric struct {
	Type   string   `json:"type"`
	Name   string   `json:"name"`
	Help   string   `json:"help"`
	Labels []string `json:"labels"`
}

type Factory added in v0.10.11

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 added in v0.10.11

func With(registry *prometheus.Registry) Factory

type HTTPParams

type HTTPParams struct {
	Method     string
	StatusCode int
}

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 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()

Jump to

Keyboard shortcuts

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