Documentation
¶
Overview ¶
Package metrics provides metrics collection for the DAST crawler.
Index ¶
- func SetGlobal(c *Collector)
- type Collector
- func (c *Collector) GetAverageResponseTime() time.Duration
- func (c *Collector) GetErrorsPerSecond() float64
- func (c *Collector) GetRequestsPerSecond() float64
- func (c *Collector) RecordAPIEndpoint()
- func (c *Collector) RecordBytes(n int64)
- func (c *Collector) RecordError(errorType string)
- func (c *Collector) RecordFormFound()
- func (c *Collector) RecordPageCrawled()
- func (c *Collector) RecordPageDiscovered()
- func (c *Collector) RecordRequest()
- func (c *Collector) RecordResponseTime(d time.Duration)
- func (c *Collector) RecordRetry()
- func (c *Collector) RecordStatusCode(code int)
- func (c *Collector) RecordWebSocket()
- func (c *Collector) Reset()
- func (c *Collector) SetActiveWorkers(n int64)
- func (c *Collector) SetBrowserPoolStats(size, inUse int64)
- func (c *Collector) SetQueueDepth(depth int64)
- func (c *Collector) Snapshot() *Snapshot
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector collects and aggregates metrics.
func (*Collector) GetAverageResponseTime ¶
GetAverageResponseTime returns the average response time.
func (*Collector) GetErrorsPerSecond ¶
GetErrorsPerSecond returns the current errors per second rate.
func (*Collector) GetRequestsPerSecond ¶
GetRequestsPerSecond returns the current requests per second rate.
func (*Collector) RecordAPIEndpoint ¶
func (c *Collector) RecordAPIEndpoint()
RecordAPIEndpoint increments API endpoints.
func (*Collector) RecordBytes ¶
RecordBytes records transferred bytes.
func (*Collector) RecordError ¶
RecordError records an error.
func (*Collector) RecordFormFound ¶
func (c *Collector) RecordFormFound()
RecordFormFound increments found forms.
func (*Collector) RecordPageCrawled ¶
func (c *Collector) RecordPageCrawled()
RecordPageCrawled increments crawled pages.
func (*Collector) RecordPageDiscovered ¶
func (c *Collector) RecordPageDiscovered()
RecordPageDiscovered increments discovered pages.
func (*Collector) RecordRequest ¶
func (c *Collector) RecordRequest()
RecordRequest records an HTTP request.
func (*Collector) RecordResponseTime ¶
RecordResponseTime records a response time.
func (*Collector) RecordRetry ¶
func (c *Collector) RecordRetry()
RecordRetry records a retry attempt.
func (*Collector) RecordStatusCode ¶
RecordStatusCode records an HTTP status code.
func (*Collector) RecordWebSocket ¶
func (c *Collector) RecordWebSocket()
RecordWebSocket increments WebSocket endpoints.
func (*Collector) SetActiveWorkers ¶
SetActiveWorkers sets the number of active workers.
func (*Collector) SetBrowserPoolStats ¶
SetBrowserPoolStats sets browser pool statistics.
func (*Collector) SetQueueDepth ¶
SetQueueDepth sets the current queue depth.
type Snapshot ¶
type Snapshot struct {
Timestamp time.Time `json:"timestamp"`
Uptime time.Duration `json:"uptime"`
RequestsTotal int64 `json:"requests_total"`
ErrorsTotal int64 `json:"errors_total"`
PagesDiscovered int64 `json:"pages_discovered"`
PagesCrawled int64 `json:"pages_crawled"`
FormsFound int64 `json:"forms_found"`
APIEndpoints int64 `json:"api_endpoints"`
WebSockets int64 `json:"websockets"`
BytesTotal int64 `json:"bytes_total"`
RetriesTotal int64 `json:"retries_total"`
QueueDepth int64 `json:"queue_depth"`
ActiveWorkers int64 `json:"active_workers"`
BrowserPoolSize int64 `json:"browser_pool_size"`
BrowserPoolInUse int64 `json:"browser_pool_in_use"`
RequestsPerSecond float64 `json:"requests_per_second"`
ErrorsPerSecond float64 `json:"errors_per_second"`
AverageResponseTime time.Duration `json:"average_response_time"`
ErrorCounts map[string]int64 `json:"error_counts"`
StatusCodes map[int]int64 `json:"status_codes"`
ResponseTimeHist []int64 `json:"response_time_histogram"`
}
Snapshot represents a point-in-time view of metrics.
func (*Snapshot) BrowserPoolUtilization ¶
BrowserPoolUtilization returns the browser pool utilization (0-1).