metrics

package
v1.1.4-testnet Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InfuraRegistry = metrics.DefaultRegistry

Note, must use metrics.DefaultRegistry from geth, since go-rpc-provider depends on it for rpc metrics by default. When RPC middleware supported at server side, we can use a custom metrics registry.

Functions

func GetOrRegisterCounter

func GetOrRegisterCounter(nameFormat string, nameArgs ...interface{}) metrics.Counter

func GetOrRegisterGauge

func GetOrRegisterGauge(nameFormat string, nameArgs ...interface{}) metrics.Gauge

func GetOrRegisterGaugeFloat64

func GetOrRegisterGaugeFloat64(nameFormat string, nameArgs ...interface{}) metrics.GaugeFloat64

func GetOrRegisterHistogram

func GetOrRegisterHistogram(nameFormat string, nameArgs ...interface{}) metrics.Histogram

func GetOrRegisterMeter

func GetOrRegisterMeter(nameFormat string, nameArgs ...interface{}) metrics.Meter

func GetOrRegisterTimer

func GetOrRegisterTimer(nameFormat string, nameArgs ...interface{}) metrics.Timer

func Init

func Init()

This package should be imported before any metric (e.g. timer, histogram) created. Because, `metrics.Enabled` in go-ethereum is `false` by default, which leads to noop metric created for static variables in any package.

In addition, this package should be imported after the initialization of viper and logrus.

func NewHistogram

func NewHistogram() metrics.Histogram

func UpdateEthRpcLogFilter

func UpdateEthRpcLogFilter(method string, eth *client.RpcEthClient, filter *types.FilterQuery)

Types

type InputBlockMetric

type InputBlockMetric struct{}

InputBlockMetric is used to add metrics for input block parameter.

func (*InputBlockMetric) Update1

func (metric *InputBlockMetric) Update1(blockNum *types.BlockNumber, method string, eth *client.RpcEthClient)

func (*InputBlockMetric) Update2

func (metric *InputBlockMetric) Update2(blockNumOrHash *types.BlockNumberOrHash, method string, eth *client.RpcEthClient)

type InputEpochMetric

type InputEpochMetric struct{}

InputEpochMetric is used to add metrics for input epoch parameter.

func (*InputEpochMetric) Update

func (metric *InputEpochMetric) Update(epoch *types.Epoch, method string, cfx sdk.ClientOperator)

Update marks the percentage for different epochs. If epoch number specified, add statistic for epoch gap against latest mined.

type Metrics

type Metrics struct {
	RPC           RpcMetrics
	PubSub        PubSubMetrics
	Sync          SyncMetrics
	Store         StoreMetrics
	Nodes         NodeManagerMetrics
	VirtualFilter VirtualFilterMetrics
}
var Registry Metrics

type NodeManagerMetrics

type NodeManagerMetrics struct{}

Node manager metrics

func (*NodeManagerMetrics) NodeAvailability

func (*NodeManagerMetrics) NodeAvailability(space, group, node string) string

func (*NodeManagerMetrics) NodeLatency

func (*NodeManagerMetrics) NodeLatency(space, group, node string) string

func (*NodeManagerMetrics) Routes

func (*NodeManagerMetrics) Routes(space, group, node string) metrics.Meter

type Percentage

type Percentage interface {
	Mark(marked bool)
	Value() float64 // e.g. 99.38 means 99.38%
}

Percentage implements the GaugeFloat64 interface for percentage statistic.

func GetOrRegisterPercentage

func GetOrRegisterPercentage(name string, args ...interface{}) Percentage

GetOrRegisterPercentage returns an existing Percentage or constructs and registers a new standard Percentage.

func GetOrRegisterTimeWindowPercentage

func GetOrRegisterTimeWindowPercentage(
	slotInterval time.Duration, numSlots int, name string, args ...interface{},
) Percentage

GetOrRegisterTimeWindowPercentage returns an existing Percentage or constructs and registers a new time window Percentage.

func GetOrRegisterTimeWindowPercentageDefault

func GetOrRegisterTimeWindowPercentageDefault(name string, args ...interface{}) Percentage

GetOrRegisterTimeWindowPercentageDefault returns an existing Percentage or constructs and registers a new time window Percentage.

func NewPercentage

func NewPercentage() Percentage

NewPercentage constructs a new standard percentage metric.

func NewTimeWindowPercentage

func NewTimeWindowPercentage(slotInterval time.Duration, numSlots int) Percentage

NewTimeWindowPercentage constructs a new time window Percentage.

type PubSubMetrics

type PubSubMetrics struct{}

PubSub metrics

func (*PubSubMetrics) InputLogFilter

func (*PubSubMetrics) InputLogFilter(space string) Percentage

func (*PubSubMetrics) Sessions

func (*PubSubMetrics) Sessions(space, topic, node string) metrics.Gauge

type RpcMetrics

type RpcMetrics struct{}

RPC metrics

func (*RpcMetrics) BatchLatency

func (*RpcMetrics) BatchLatency() metrics.Histogram

func (*RpcMetrics) BatchSize

func (*RpcMetrics) BatchSize() metrics.Histogram

func (*RpcMetrics) FullnodeErrorRate

func (*RpcMetrics) FullnodeErrorRate(node ...string) Percentage

func (*RpcMetrics) FullnodeNonRpcErrorRate

func (*RpcMetrics) FullnodeNonRpcErrorRate(node ...string) Percentage

func (*RpcMetrics) FullnodeQps

func (*RpcMetrics) FullnodeQps(node, space, method string, err error) metrics.Timer

func (*RpcMetrics) InputBlock

func (*RpcMetrics) InputBlock(method, block string) Percentage

func (*RpcMetrics) InputBlockGap

func (*RpcMetrics) InputBlockGap(method string) metrics.Histogram

func (*RpcMetrics) InputEpoch

func (*RpcMetrics) InputEpoch(method, epoch string) Percentage

func (*RpcMetrics) InputEpochGap

func (*RpcMetrics) InputEpochGap(method string) metrics.Histogram

func (*RpcMetrics) Percentage

func (*RpcMetrics) Percentage(method, name string) Percentage

func (*RpcMetrics) StoreHit

func (*RpcMetrics) StoreHit(method, storeName string) Percentage

func (*RpcMetrics) UpdateDuration

func (*RpcMetrics) UpdateDuration(method string, err error, start time.Time)

type StoreMetrics

type StoreMetrics struct{}

Store metrics

func (*StoreMetrics) GetLogs

func (*StoreMetrics) GetLogs() TimerUpdater

func (*StoreMetrics) Pop

func (*StoreMetrics) Pop(storeName string) TimerUpdater

func (*StoreMetrics) Push

func (*StoreMetrics) Push(storeName string) TimerUpdater

type SyncMetrics

type SyncMetrics struct{}

Sync service metrics

func (*SyncMetrics) QueryEpochData

func (*SyncMetrics) QueryEpochData(space string) TimerUpdater

func (*SyncMetrics) QueryEpochDataAvailability

func (*SyncMetrics) QueryEpochDataAvailability(space string) Percentage

func (*SyncMetrics) SyncOnceQps

func (*SyncMetrics) SyncOnceQps(space, storeName string, err error) metrics.Timer

func (*SyncMetrics) SyncOnceSize

func (*SyncMetrics) SyncOnceSize(space, storeName string) metrics.Histogram

type TimerUpdater

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

TimerUpdater is used to update timer metric with native defer syntax.

func NewTimerUpdater

func NewTimerUpdater(timer metrics.Timer) TimerUpdater

NewTimerUpdater creates an instance to update timer metric.

func NewTimerUpdaterByName

func NewTimerUpdaterByName(name string) TimerUpdater

NewTimerUpdaterByName creates an instance to update timer metric of specified name.

func (*TimerUpdater) Update

func (updater *TimerUpdater) Update()

Update updates the underlying timer metric.

func (*TimerUpdater) UpdateDuration

func (updater *TimerUpdater) UpdateDuration(duration time.Duration)

Update updates the underlying timer metric with duration.

type VirtualFilterMetrics

type VirtualFilterMetrics struct{}

Virtual filter metrics

func (*VirtualFilterMetrics) PersistFilterChanges

func (*VirtualFilterMetrics) PersistFilterChanges(node, store string) TimerUpdater

func (*VirtualFilterMetrics) PollOnceQps

func (*VirtualFilterMetrics) PollOnceQps(node string, err error) metrics.Timer

func (*VirtualFilterMetrics) PollOnceSize

func (*VirtualFilterMetrics) PollOnceSize(node string) metrics.Histogram

func (*VirtualFilterMetrics) QueryFilterChanges

func (*VirtualFilterMetrics) QueryFilterChanges(node, store string) TimerUpdater

func (*VirtualFilterMetrics) Sessions

func (*VirtualFilterMetrics) Sessions(filterType, node string) metrics.Gauge

func (*VirtualFilterMetrics) StoreQueryPercentage

func (*VirtualFilterMetrics) StoreQueryPercentage(node, store string) Percentage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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