metrics

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketConfig

type BucketConfig struct {
	Distribution BucketDistribution `mapstructure:"distribution"`
	MaxLatency   time.Duration      `mapstructure:"max-latency"`
	BucketCount  int                `mapstructure:"bucket-count"`
	Values       []float64          `mapstructure:"values"`
}

BucketConfig describes the latency bucket distribution.

func (*BucketConfig) Buckets

func (c *BucketConfig) Buckets() []float64

Buckets returns a list of buckets for latency monitoring.

type BucketDistribution

type BucketDistribution string

BucketDistribution can be empty, uniform, or fixed.

const (
	BucketEmpty   BucketDistribution = "empty"
	BucketUniform BucketDistribution = "uniform"
	BucketFixed   BucketDistribution = "fixed"
)

Sample and bucket constants.

type Config

type Config struct {
	monitoring.Config `mapstructure:",squash" yaml:",inline"`
	Latency           LatencyConfig `mapstructure:"latency" yaml:"latency"`
}

Config describes the load generator metrics. It adds latency tracker to the common metrics configurations.

type KeyTracingSampler

type KeyTracingSampler = func(key string) bool

KeyTracingSampler returns true to sample a given key.

type LatencyConfig

type LatencyConfig struct {
	SamplerConfig SamplerConfig `mapstructure:"sampler"`
	BucketConfig  BucketConfig  `mapstructure:"buckets"`
}

LatencyConfig describes the latency monitoring parameters.

type MetricState

type MetricState struct {
	BlocksSent            uint64
	BlocksReceived        uint64
	TransactionsSent      uint64
	TransactionsReceived  uint64
	TransactionsCommitted uint64
	TransactionsAborted   uint64
}

MetricState is a collection of the current values of the metrics.

type NumberTracingSampler

type NumberTracingSampler = func(blockNumber uint64) bool

NumberTracingSampler returns true to sample a given number.

type PerfMetrics

type PerfMetrics struct {
	*monitoring.Provider
	// contains filtered or unexported fields
}

PerfMetrics is a struct that contains the metrics for the block generator.

func NewLoadgenServiceMetrics

func NewLoadgenServiceMetrics(c *Config) *PerfMetrics

NewLoadgenServiceMetrics creates a new PerfMetrics instance.

func (*PerfMetrics) GetState

func (c *PerfMetrics) GetState() MetricState

GetState returns the number of committed transactions.

func (*PerfMetrics) OnReceiveBatch

func (c *PerfMetrics) OnReceiveBatch(batch []TxStatus)

OnReceiveBatch increments the transaction received total and calls the latency tracker.

func (*PerfMetrics) OnSendBatch

func (c *PerfMetrics) OnSendBatch(txIDs []string)

OnSendBatch is a function that increments the block sent total and calls the latency tracker.

func (*PerfMetrics) OnSendTransaction

func (c *PerfMetrics) OnSendTransaction(txID string)

OnSendTransaction is a function that increments the transaction sent total and calls the latency tracker.

type SamplerConfig

type SamplerConfig struct {
	// Prefix checks for TXs that have the given prefix.
	Prefix string `mapstructure:"prefix" json:"prefix,omitempty"`
	// Portion uses the simple and efficient hash of the key to sample the required portion of TXs.
	Portion float64 `mapstructure:"portion" json:"portion,omitempty"`
}

SamplerConfig describes the latency sampling parameters.

func (*SamplerConfig) TxSampler

func (c *SamplerConfig) TxSampler() KeyTracingSampler

TxSampler returns a KeyTracingSampler for latency monitoring.

type TraceSamplerType

type TraceSamplerType string

TraceSamplerType can be always, never, prefix, hash, or timer.

type TxStatus

type TxStatus struct {
	TxID   string
	Status protoblocktx.Status
}

TxStatus is used to report a batch item.

Jump to

Keyboard shortcuts

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