Documentation
¶
Index ¶
- type BlockCollector
- func (bc *BlockCollector) GetBlockStats() BlockStats
- func (bc *BlockCollector) GetWindowBlockStats() BlockStats
- func (bc *BlockCollector) GetWindowBlockTimePercentile(percentile int) time.Duration
- func (bc *BlockCollector) ResetWindowStats()
- func (bc *BlockCollector) Run(ctx context.Context, firstEndpoint string) error
- type BlockStats
- type BlockStatsProvider
- type Collector
- func (c *Collector) EmitRunSummary(ctx context.Context)
- func (c *Collector) GetBlockCollector() *BlockCollector
- func (c *Collector) GetCumulativeBlockStats() *BlockStats
- func (c *Collector) GetStats() Stats
- func (c *Collector) RecordTransaction(scenario, endpoint string, latency time.Duration, success bool)
- func (c *Collector) ResetWindowStats()
- func (c *Collector) SetBlockCollector(bc *BlockCollector)
- type EndpointPerformance
- type EndpointStats
- type FinalStats
- type LoadTestStatistics
- type Logger
- type MockBlockStats
- func (m *MockBlockStats) GetBlockStats() BlockStats
- func (m *MockBlockStats) GetResetCallCount() int
- func (m *MockBlockStats) GetWindowBlockStats() BlockStats
- func (m *MockBlockStats) GetWindowBlockTimePercentile(percentile int) time.Duration
- func (m *MockBlockStats) HasPendingPercentile(percentile int) bool
- func (m *MockBlockStats) ResetWindowStats()
- func (m *MockBlockStats) SetBlockStats(stats BlockStats) *MockBlockStats
- func (m *MockBlockStats) SetPercentile(percentile int, duration time.Duration) *MockBlockStats
- func (m *MockBlockStats) SetWindowBlockStats(stats BlockStats) *MockBlockStats
- type OverallPerformance
- type OverallTPS
- type Stats
- type TPSWindow
- type UserLatencyTracker
- type WindowStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockCollector ¶
type BlockCollector struct {
// contains filtered or unexported fields
}
BlockCollector subscribes to new blocks and tracks block metrics
func NewBlockCollector ¶
func NewBlockCollector(seiChainID string) *BlockCollector
NewBlockCollector creates a new block data collector
func (*BlockCollector) GetBlockStats ¶
func (bc *BlockCollector) GetBlockStats() BlockStats
GetBlockStats returns current block statistics
func (*BlockCollector) GetWindowBlockStats ¶
func (bc *BlockCollector) GetWindowBlockStats() BlockStats
GetWindowBlockStats returns current window-based block statistics
func (*BlockCollector) GetWindowBlockTimePercentile ¶
func (bc *BlockCollector) GetWindowBlockTimePercentile(percentile int) time.Duration
func (*BlockCollector) ResetWindowStats ¶
func (bc *BlockCollector) ResetWindowStats()
ResetWindowStats resets the window-based statistics for the next reporting period
type BlockStats ¶
type BlockStats struct {
MaxBlockNumber uint64 `json:"max_block_number"`
P50BlockTime time.Duration `json:"p50_block_time"`
P99BlockTime time.Duration `json:"p99_block_time"`
MaxBlockTime time.Duration `json:"max_block_time"`
P50GasUsed uint64 `json:"p50_gas_used"`
P99GasUsed uint64 `json:"p99_gas_used"`
MaxGasUsed uint64 `json:"max_gas_used"`
SampleCount int `json:"sample_count"`
}
BlockStats represents block-related statistics
func (BlockStats) FormatBlockStats ¶
func (bs BlockStats) FormatBlockStats() string
FormatBlockStats returns a formatted string representation of block statistics
type BlockStatsProvider ¶
type BlockStatsProvider interface {
GetBlockStats() BlockStats
GetWindowBlockStats() BlockStats
GetWindowBlockTimePercentile(percentile int) time.Duration
ResetWindowStats()
}
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector tracks comprehensive statistics for load testing
func (*Collector) EmitRunSummary ¶
EmitRunSummary records the run-summary gauges. Call once at shutdown.
func (*Collector) GetBlockCollector ¶
func (c *Collector) GetBlockCollector() *BlockCollector
GetBlockCollector returns the block collector
func (*Collector) GetCumulativeBlockStats ¶
func (c *Collector) GetCumulativeBlockStats() *BlockStats
GetCumulativeBlockStats returns cumulative block stats for final summary
func (*Collector) RecordTransaction ¶
func (c *Collector) RecordTransaction(scenario, endpoint string, latency time.Duration, success bool)
RecordTransaction records a transaction attempt
func (*Collector) ResetWindowStats ¶
func (c *Collector) ResetWindowStats()
ResetWindowStats resets the window statistics for all endpoints
func (*Collector) SetBlockCollector ¶
func (c *Collector) SetBlockCollector(bc *BlockCollector)
SetBlockCollector sets the block collector for this stats collector
type EndpointPerformance ¶
type EndpointPerformance struct {
LatencyP50 time.Duration `json:"latency_p50"`
LatencyP99 time.Duration `json:"latency_p99"`
SampleCount int `json:"sample_count"`
CurrentTPS float64 `json:"current_tps"`
MaxTPS float64 `json:"max_tps"`
WindowTxCount uint64 `json:"window_tx_count"`
WindowLatencySum time.Duration `json:"window_latency_sum"`
WindowLatencyCount int `json:"window_latency_count"`
WindowMaxLatency time.Duration `json:"window_max_latency"`
WindowMinLatency time.Duration `json:"window_min_latency"`
CumulativeMaxTPS float64 `json:"cumulative_max_tps"`
CumulativeMaxLatency time.Duration `json:"cumulative_max_latency"`
}
EndpointPerformance represents detailed performance metrics for an endpoint
type EndpointStats ¶
type EndpointStats struct {
Endpoint string
P50Latency time.Duration
P99Latency time.Duration
MaxTPS float64
CurrentTPS float64
SampleCount int
QueueDepth int // Current queue depth for monitoring backpressure
// Window stats
WindowTxCount uint64
WindowLatencySum time.Duration
WindowLatencyCount int
WindowMaxLatency time.Duration
WindowMinLatency time.Duration
CumulativeMaxTPS float64
CumulativeMaxLatency time.Duration
}
EndpointStats represents statistics for a specific endpoint
type FinalStats ¶
type FinalStats struct {
LoadTestStatistics LoadTestStatistics `json:"load_test_statistics"`
ScenarioDistribution map[string]uint64 `json:"scenario_distribution"`
EndpointPerformance map[string]EndpointPerformance `json:"endpoint_performance"`
OverallTPS OverallTPS `json:"overall_tps"`
BlockStatistics *BlockStats `json:"block_statistics,omitempty"`
OverallPerformance OverallPerformance `json:"overall_performance"`
GasStatistics *BlockStats `json:"gas_statistics,omitempty"`
}
FinalStats represents the complete final statistics that can be marshaled to JSON
func (*FinalStats) String ¶
func (fs *FinalStats) String() string
String returns a formatted string representation of the final statistics
type LoadTestStatistics ¶
type LoadTestStatistics struct {
Runtime time.Duration `json:"runtime"`
TotalTxs uint64 `json:"total_txs"`
AvgTPS float64 `json:"avg_tps"`
StartTime time.Time `json:"start_time"`
}
LoadTestStatistics represents basic load test metrics
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger handles periodic statistics logging and dry-run transaction printing
func (*Logger) BuildFinalStats ¶
func (l *Logger) BuildFinalStats() *FinalStats
BuildFinalStats creates a FinalStats struct from the current collector data
func (*Logger) LogFinalStats ¶
func (l *Logger) LogFinalStats()
LogFinalStats logs comprehensive final statistics
type MockBlockStats ¶
type MockBlockStats struct {
// contains filtered or unexported fields
}
MockBlockStats is a test implementation of BlockStatsProvider
func NewMockBlockStats ¶
func NewMockBlockStats() *MockBlockStats
NewMockBlockStats creates a new MockBlockStats instance
func (*MockBlockStats) GetBlockStats ¶
func (m *MockBlockStats) GetBlockStats() BlockStats
GetBlockStats returns the preset block stats
func (*MockBlockStats) GetResetCallCount ¶
func (m *MockBlockStats) GetResetCallCount() int
GetResetCallCount returns how many times ResetWindowStats was called
func (*MockBlockStats) GetWindowBlockStats ¶
func (m *MockBlockStats) GetWindowBlockStats() BlockStats
GetWindowBlockStats returns the preset window block stats
func (*MockBlockStats) GetWindowBlockTimePercentile ¶
func (m *MockBlockStats) GetWindowBlockTimePercentile(percentile int) time.Duration
GetWindowBlockTimePercentile returns the preset value for the given percentile
func (*MockBlockStats) HasPendingPercentile ¶
func (m *MockBlockStats) HasPendingPercentile(percentile int) bool
HasPendingPercentile checks if there's a pending value for the given percentile
func (*MockBlockStats) ResetWindowStats ¶
func (m *MockBlockStats) ResetWindowStats()
ResetWindowStats tracks the number of times it's called
func (*MockBlockStats) SetBlockStats ¶
func (m *MockBlockStats) SetBlockStats(stats BlockStats) *MockBlockStats
SetBlockStats sets the return value for GetBlockStats()
func (*MockBlockStats) SetPercentile ¶
func (m *MockBlockStats) SetPercentile(percentile int, duration time.Duration) *MockBlockStats
SetPercentile sets the return value for the next call to GetWindowBlockTimePercentile with the given percentile
func (*MockBlockStats) SetWindowBlockStats ¶
func (m *MockBlockStats) SetWindowBlockStats(stats BlockStats) *MockBlockStats
SetWindowBlockStats sets the return value for GetWindowBlockStats()
type OverallPerformance ¶
type OverallPerformance struct {
TotalRuntime time.Duration `json:"total_runtime"`
TotalTransactions uint64 `json:"total_transactions"`
AverageTPS float64 `json:"average_tps"`
MaxTPS float64 `json:"max_tps"`
}
OverallPerformance represents comprehensive performance summary
type OverallTPS ¶
OverallTPS represents overall throughput metrics
type Stats ¶
type Stats struct {
StartTime time.Time
TotalTxs uint64
TxCounts map[string]map[string]uint64 // [scenario][endpoint] -> count
EndpointStats map[string]EndpointStats
OverallMaxTPS float64
OverallCurrentTPS float64
BlockStats *BlockStats // Block-related statistics
}
Stats represents comprehensive load test statistics
func (*Stats) FormatStats ¶
FormatStats returns a formatted string representation of the statistics
type TPSWindow ¶
type TPSWindow struct {
// contains filtered or unexported fields
}
TPSWindow tracks transactions in a sliding 10-second window
type UserLatencyTracker ¶
type UserLatencyTracker struct {
// contains filtered or unexported fields
}
UserLatencyTracker tracks user latency by analyzing block transactions
func NewUserLatencyTracker ¶
func NewUserLatencyTracker(interval time.Duration) *UserLatencyTracker
NewUserLatencyTracker creates a new user latency tracker
type WindowStats ¶
type WindowStats struct {
// contains filtered or unexported fields
}
WindowStats tracks metrics for the current reporting window