Documentation ¶
Overview ¶
Package metrics [everything related to metrics goes here]
Index ¶
- Constants
- Variables
- func ExportPrometheusMetrics(ctx context.Context, logger *zap.Logger, clientID, gateways 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, prometheusPushGateways *string)
- func ReportStatistics(traffic int64, clientID string) error
- func ValidatePrometheusPushGateways(gatewayURLsCSV string) bool
- type NopWriter
- type Storage
- type Writer
Constants ¶
const ( Traffic = "traffic" ProcessedTraffic = "processed_traffic" )
supported default metrics
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 ¶
var BasicAuth = `YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCBpYWlSV1VBRWcweEt2NWdTd240a0JBIDE4CmlONnhLcURxWEVWdmFuU1Rh` +
`SVl0dmplNGpLc0FqLzN5SE5neXdnM0xIMVUKLS0tIE1YdVNBVmk1NG9zNzRpQnh2R3U3MDBpWm5MNUxCb0hNeGxKTERGRDFRamMKJkpimmJGSDmx` +
`BX2e38Z38EQZK7aq/W29YMbZKz/omNL0GPvurXZA6GTPmmlD/XZ+EjCkW6bKajIS9y9533tsn6MR8NMtFJoS+z7M9b/yd8YJR6fW069b2A==`
BasicAuth client's credentials for push gateway encrypted with utils/crypto.go#EncryptionKeys[0] key
var Default = Storage{ // contains filtered or unexported fields }
Default to allow global access for ease of use similar to http.DefaultClient and such
var PushGatewayCA string
PushGatewayCA variable to embed self-signed CA for TLS
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.
func ReportStatistics ¶ added in v0.8.13
ReportStatistics sends basic usage events to google analytics
func ValidatePrometheusPushGateways ¶
ValidatePrometheusPushGateways split value into list of comma separated values and validate that each value is valid URL
Types ¶
type NopWriter ¶ added in v0.8.1
type NopWriter struct{}
NopWriter implements io.Writer interface to simply track how much data has to be serialized
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a general struct to store custom metrics
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is a helper to accumulate writes to a storage on a regular basis