Documentation
¶
Overview ¶
Package performance_engine provides multi-mode performance and load testing for ZAP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutionMetrics ¶
type ExecutionMetrics struct {
Total int `json:"total"`
Success int `json:"success"`
Fail int `json:"fail"`
SuccessRate float64 `json:"success_rate"`
AvgLatency time.Duration `json:"avg_latency"`
P50 time.Duration `json:"p50"`
P95 time.Duration `json:"p95"`
P99 time.Duration `json:"p99"`
Min time.Duration `json:"min"`
Max time.Duration `json:"max"`
RPS float64 `json:"rps"`
}
ExecutionMetrics holds the final results of a performance test run.
func (*ExecutionMetrics) FormatSummary ¶
func (m *ExecutionMetrics) FormatSummary(mode string) string
FormatSummary returns a human-readable summary of the performance metrics.
type LoadTestRunner ¶
type LoadTestRunner struct {
// contains filtered or unexported fields
}
LoadTestRunner executes the actual load simulation.
func NewLoadTestRunner ¶
func NewLoadTestRunner(httpTool *shared.HTTPTool, params PerformanceParams) *LoadTestRunner
NewLoadTestRunner creates a new load test runner.
func (*LoadTestRunner) Run ¶
func (r *LoadTestRunner) Run(endpoints map[string]shared.EndpointAnalysis) ExecutionMetrics
Run executes the performance test according to the mode.
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector accumulates request statistics during a test run.
func (*MetricsCollector) Finalize ¶
func (c *MetricsCollector) Finalize() ExecutionMetrics
Finalize calculates the final metrics from the collected statistics.
func (*MetricsCollector) Record ¶
func (c *MetricsCollector) Record(stat RequestStat)
Record adds a single request statistic to the collector.
type PerformanceEngineTool ¶
type PerformanceEngineTool struct {
// contains filtered or unexported fields
}
PerformanceEngineTool provides multi-mode load testing and metrics tracking.
func NewPerformanceEngineTool ¶
func NewPerformanceEngineTool(falconDir string, httpTool *shared.HTTPTool, reportWriter *shared.ReportWriter) *PerformanceEngineTool
NewPerformanceEngineTool creates a new performance engine tool.
func (*PerformanceEngineTool) Description ¶
func (t *PerformanceEngineTool) Description() string
Description returns the tool description.
func (*PerformanceEngineTool) Execute ¶
func (t *PerformanceEngineTool) Execute(args string) (string, error)
Execute performs the performance test.
func (*PerformanceEngineTool) Name ¶
func (t *PerformanceEngineTool) Name() string
Name returns the tool name.
func (*PerformanceEngineTool) Parameters ¶
func (t *PerformanceEngineTool) Parameters() string
Parameters returns the tool parameter description.
type PerformanceParams ¶
type PerformanceParams struct {
Mode string `json:"mode"` // load, stress, spike, soak
BaseURL string `json:"base_url"` // Base URL of the API
Endpoints []string `json:"endpoints,omitempty"` // Specific endpoints to test
Concurrency int `json:"concurrency,omitempty"` // Number of concurrent virtual users (default: 10)
Duration int `json:"duration_sec,omitempty"` // Duration of test in seconds (default: 30)
RPS int `json:"rps,omitempty"` // Target requests per second (optional)
ReportName string `json:"report_name,omitempty"` // e.g. "performance_report_dummyjson_products"
}
PerformanceParams defines parameters for performance testing.