metrics

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 13 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.

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 {
	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
	CreatedKeys           uint64
	ReferencedReadKeys    uint64
	ReferencedWriteKeys   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, counter *workload.TxCounter) *PerfMetrics

NewLoadgenServiceMetrics creates a new PerfMetrics instance. The key-generation counters read from the shared counter at scrape time via KeyStats.

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.

type SamplerConfig

type SamplerConfig struct {
	Prefix        string  `mapstructure:"prefix" json:"prefix,omitempty"`
	Portion       float64 `mapstructure:"portion" json:"portion,omitempty"`
	MaxTrackedTXs uint64  `mapstructure:"max-tracked-txs" json:"max-tracked-txs,omitempty"`
}

SamplerConfig describes the latency sampling parameters. Prefix checks for TXs that have the given prefix. Portion uses the simple and efficient hash of the key to sample the required portion of TXs. MaxTrackedTXs is used to prevent unbounded growth of the tracked TXs data structure.

type TraceSamplerType

type TraceSamplerType string

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

type TxStatus

type TxStatus struct {
	TxID   string
	Status committerpb.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
⌂ 换网址