Documentation ¶
Overview ¶
Package metrics collects and reports job metrics.
Index ¶
- Constants
- func ExportPrometheusMetrics(ctx context.Context, logger *zap.Logger, clientID, listen string)
- func IncClient()
- func IncDNSBlast(rootDomain, seedDomain, protocol, status string)
- func IncHTTP(host, method, status string)
- func IncPacketgen(host, hostPort, protocol, status, id string)
- func IncRawnetTCP(address, status string)
- func IncRawnetUDP(address, status string)
- func IncSlowLoris(address, protocol, status string)
- func Init(clientID, country string)
- func InitOrFail(ctx context.Context, logger *zap.Logger, prometheusOn bool, ...)
- func NewOptionsWithFlags() (prometheusOn *bool, prometheusListenAddress *string)
- type Accumulator
- type ConsoleReporter
- type Metrics
- type PerTargetStats
- type Reporter
- type Stat
- type Stats
- type StatsTracker
- type ZapReporter
Constants ¶
const ( StatusLabel = `status` StatusSuccess = `success` StatusFail = `fail` )
common values for prometheus metrics
const ( DNSBlastRootDomainLabel = `root_domain` DNSBlastSeedDomainLabel = `seed_domain` DNSBlastProtocolLabel = `protocol` )
DNS Blast related values and labels for prometheus metrics
const ( HTTPDestinationHostLabel = `destination_host` HTTPMethodLabel = `method` )
HTTP related values and labels
const ( PacketgenHostLabel = `host` PacketgenDstHostPortLabel = `dst_host_port` PacketgenProtocolLabel = `protocol` )
Packetgen related values and labels
const ( SlowlorisAddressLabel = `address` SlowlorisProtocolLabel = `protocol` )
Slowloris related values and labels
const ( RawnetAddressLabel = `address` RawnetProtocolLabel = `protocol` )
Rawnet related values and labels
const ( ClientIDLabel = `id` CountryLabel = `country` )
Client related values and labels
Variables ¶
This section is empty.
Functions ¶
func ExportPrometheusMetrics ¶
ExportPrometheusMetrics starts http server and export metrics at address <ip>:9090/metrics, also pushes metrics to gateways randomly
func IncClient ¶ added in v0.7.10
func IncClient()
IncClient increments counter of calls from the current client ID
func IncDNSBlast ¶
func IncDNSBlast(rootDomain, seedDomain, protocol, status string)
IncDNSBlast increments counter of sent dns queries
func IncHTTP ¶
func IncHTTP(host, method, status string)
IncHTTP increments counter of sent http queries
func IncPacketgen ¶
func IncPacketgen(host, hostPort, protocol, status, id string)
IncPacketgen increments counter of sent raw packets
func IncRawnetTCP ¶
func IncRawnetTCP(address, status string)
IncRawnetTCP increments counter of sent raw tcp packets
func IncRawnetUDP ¶
func IncRawnetUDP(address, status string)
IncRawnetUDP increments counter of sent raw tcp packets
func IncSlowLoris ¶
func IncSlowLoris(address, protocol, status string)
IncSlowLoris increments counter of sent raw ethernet+ip+tcp/udp packets
func InitOrFail ¶ added in v0.8.4
func NewOptionsWithFlags ¶ added in v0.8.4
NewOptionsWithFlags returns metrics options initialized with command line flags.
Types ¶
type Accumulator ¶ added in v0.8.23
type Accumulator struct {
// contains filtered or unexported fields
}
Accumulator for statistical metrics for use in a single job. Requires Flush()-ing to Reporter. Not concurrency-safe.
func (*Accumulator) Add ¶ added in v0.8.23
func (a *Accumulator) Add(target string, s Stat, n uint64) *Accumulator
Add n to the Accumulator Stat value. Returns self for chaining.
func (*Accumulator) Clone ¶ added in v0.8.23
func (a *Accumulator) Clone(jobID string) *Accumulator
Clone a new, blank metrics Accumulator with the same Reporter as the original.
func (*Accumulator) Flush ¶ added in v0.8.23
func (a *Accumulator) Flush()
Flush Accumulator contents to the Reporter.
func (*Accumulator) Inc ¶ added in v0.8.23
func (a *Accumulator) Inc(target string, s Stat) *Accumulator
Inc increases Accumulator Stat value by 1. Returns self for chaining.
type ConsoleReporter ¶ added in v0.8.32
type ConsoleReporter struct {
// contains filtered or unexported fields
}
func (*ConsoleReporter) WriteSummary ¶ added in v0.8.32
func (r *ConsoleReporter) WriteSummary(tracker *StatsTracker)
type Metrics ¶ added in v0.8.32
type Metrics [NumStats]sync.Map // Array of metrics by Stat. Each metric is a map of uint64 values by dimensions.
func (*Metrics) NewAccumulator ¶ added in v0.8.32
func (m *Metrics) NewAccumulator(jobID string) *Accumulator
NewAccumulator returns a new metrics Accumulator for the Reporter.
func (*Metrics) SumAllStats ¶ added in v0.8.32
func (m *Metrics) SumAllStats(groupTargets bool) (stats PerTargetStats, totals Stats)
Calculates all targets and total stats
type PerTargetStats ¶ added in v0.8.23
PerTargetStats is a map of Stats per target.
func (PerTargetStats) Diff ¶ added in v0.9.14
func (ts PerTargetStats) Diff(other PerTargetStats) PerTargetStats
func (PerTargetStats) MarshalLogObject ¶ added in v0.8.31
func (ts PerTargetStats) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject is required to log PerTargetStats objects to zap
type Reporter ¶ added in v0.8.23
type Reporter interface { // WriteSummary dumps Reporter contents into the target. WriteSummary(*StatsTracker) }
Reporter gathers metrics across jobs and reports them. Concurrency-safe.
func NewConsoleReporter ¶ added in v0.8.32
NewConsoleReporter creates a new Reporter which outputs straight to the console
type Stats ¶ added in v0.8.23
Stats contains all metrics packed as an array.
func (*Stats) MarshalLogObject ¶ added in v0.8.31
func (stats *Stats) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject is required to log Stats objects to zap
type StatsTracker ¶ added in v0.9.16
type StatsTracker struct {
// contains filtered or unexported fields
}
StatsTracker generalizes tracking stats changes between reports
func NewStatsTracker ¶ added in v0.9.16
func NewStatsTracker(metrics *Metrics) *StatsTracker
type ZapReporter ¶ added in v0.8.32
type ZapReporter struct {
// contains filtered or unexported fields
}
func (*ZapReporter) WriteSummary ¶ added in v0.8.32
func (r *ZapReporter) WriteSummary(tracker *StatsTracker)