Documentation
¶
Index ¶
- type ModuleMetrics
- func (mm *ModuleMetrics) ConsideredCount() int64
- func (mm *ModuleMetrics) DistinctCount() int64
- func (mm *ModuleMetrics) MarkConsidered(moduleID string)
- func (mm *ModuleMetrics) Record(moduleID string, duration time.Duration, findings int, err error)
- func (mm *ModuleMetrics) Snapshot() map[string]ModuleStatsSnapshot
- func (mm *ModuleMetrics) TotalInvocations() int64
- type ModuleStats
- type ModuleStatsSnapshot
- type Tracker
- func (t *Tracker) Blocked() int64
- func (t *Tracker) Findings() int64
- func (t *Tracker) Increment()
- func (t *Tracker) IncrementBlocked()
- func (t *Tracker) IncrementFindings()
- func (t *Tracker) Processed() int64
- func (t *Tracker) Start(ctx context.Context)
- func (t *Tracker) Stop()
- func (t *Tracker) Total() int64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ModuleMetrics ¶
type ModuleMetrics struct {
// contains filtered or unexported fields
}
ModuleMetrics tracks metrics for all modules in a scan.
func (*ModuleMetrics) ConsideredCount ¶
func (mm *ModuleMetrics) ConsideredCount() int64
ConsideredCount returns the number of distinct modules whose CanProcess has been evaluated at least once. Reaches the total enabled-module count once every module has been seen, regardless of whether any of them actually ran.
func (*ModuleMetrics) DistinctCount ¶
func (mm *ModuleMetrics) DistinctCount() int64
DistinctCount returns the number of distinct modules that have been invoked at least once.
func (*ModuleMetrics) MarkConsidered ¶
func (mm *ModuleMetrics) MarkConsidered(moduleID string)
MarkConsidered records that a module was evaluated against a record — i.e., CanProcess was called — regardless of whether the module actually ran. Used by the status counter so it can reach parity with the total module count even when some modules' CanProcess always rejects the input shape (e.g., POST-only modules in a GET-only scan).
func (*ModuleMetrics) Record ¶
Record records a single module invocation with its duration, finding count, and error. Safe to call on nil receiver. Implies MarkConsidered — a module that ran was necessarily considered.
func (*ModuleMetrics) Snapshot ¶
func (mm *ModuleMetrics) Snapshot() map[string]ModuleStatsSnapshot
Snapshot returns a point-in-time snapshot of all module metrics. Safe to call on nil receiver.
func (*ModuleMetrics) TotalInvocations ¶
func (mm *ModuleMetrics) TotalInvocations() int64
TotalInvocations returns the sum of all module invocations across all modules.
type ModuleStats ¶
type ModuleStats struct {
Invocations atomic.Int64
Findings atomic.Int64
Errors atomic.Int64
TotalTimeNs atomic.Int64 // nanoseconds spent in module scan functions
}
ModuleStats tracks per-module performance metrics using atomic counters for lock-free concurrent access from multiple worker goroutines.
type ModuleStatsSnapshot ¶
type ModuleStatsSnapshot struct {
Invocations int64
Findings int64
Errors int64
TotalTime time.Duration
}
ModuleStatsSnapshot is a point-in-time snapshot of a module's metrics.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker tracks scan statistics and prints progress periodically.
func New ¶
New creates a new stats Tracker. Returns nil if silent is true. If total is 0, it means the total count is unknown.
func (*Tracker) Increment ¶
func (t *Tracker) Increment()
Increment adds 1 to the processed count (thread-safe).
func (*Tracker) IncrementBlocked ¶
func (t *Tracker) IncrementBlocked()
IncrementBlocked adds 1 to the blocked count (thread-safe).
func (*Tracker) IncrementFindings ¶
func (t *Tracker) IncrementFindings()
IncrementFindings adds 1 to the findings count (thread-safe).
func (*Tracker) Start ¶
Start begins printing statistics every 5 seconds. Should be called once. Blocks until ctx is done or Stop is called.