metrics

package
v1.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AppsecBlockCounterMetricName = "cs_appsec_block_total"
View Source
const AppsecGlobalParsingHistogramMetricName = "cs_appsec_parsing_time_seconds"
View Source
const AppsecInbandParsingHistogramMetricName = "cs_appsec_inband_parsing_time_seconds"
View Source
const AppsecOutbandParsingHistogramMetricName = "cs_appsec_outband_parsing_time_seconds"
View Source
const AppsecReqCounterMetricName = "cs_appsec_reqs_total"
View Source
const AppsecRuleHitsMetricName = "cs_appsec_rule_hits"
View Source
const BucketPouredMetricName = "cs_bucket_poured_total"
View Source
const BucketsCanceledMetricName = "cs_bucket_canceled_total"
View Source
const BucketsCurrentCountMetricName = "cs_buckets"
View Source
const BucketsInstantiationMetricName = "cs_bucket_instantiation_total"
View Source
const BucketsOverflowMetricName = "cs_bucket_overflowed_total"
View Source
const BucketsUnderflowMetricName = "cs_bucket_underflowed_total"
View Source
const CacheMetricName = "cs_cache_size"
View Source
const CloudWatchDatasourceLinesReadMetricName = "cs_cloudwatch_stream_hits_total"
View Source
const CloudWatchDatasourceOpenedStreamsMetricName = "cs_cloudwatch_openstreams_total"
View Source
const DockerDatasourceLinesReadMetricName = "cs_dockersource_hits_total"
View Source
const FileDatasourceLinesReadMetricName = "cs_filesource_hits_total"
View Source
const GlobalActiveDecisionsMetricName = "cs_active_decisions"
View Source
const GlobalAlertsMetricName = "cs_alerts"
View Source
const GlobalBucketPourKoMetricName = "cs_bucket_pour_ko_total"
View Source
const GlobalBucketPourOkMetricName = "cs_bucket_pour_ok_total"
View Source
const GlobalCsInfoMetricName = "cs_info"
View Source
const GlobalParserHitsKoMetricName = "cs_parser_hits_ko_total"
View Source
const GlobalParserHitsMetricName = "cs_parser_hits_total"
View Source
const GlobalParserHitsOkMetricName = "cs_parser_hits_ok_total"
View Source
const GlobalParsingHistogramMetricName = "cs_parsing_time_seconds"
View Source
const GlobalPourHistogramMetricName = "cs_bucket_pour_seconds"
View Source
const HTTPDataSourceLinesReadMetricName = "cs_httpsource_hits_total"
View Source
const JournalCtlDataSourceLinesReadMetricName = "cs_journalctlsource_hits_total"
View Source
const K8SAuditDataSourceEventCountMetricName = "cs_k8sauditsource_hits_total"
View Source
const K8SAuditDataSourceRequestCountMetricName = "cs_k8sauditsource_requests_total"
View Source
const KafkaDataSourceLinesReadMetricName = "cs_kafkasource_hits_total"
View Source
const KinesisDataSourceLinesReadMetricName = "cs_kinesis_stream_hits_total"
View Source
const KinesisDataSourceLinesReadShardsMetricName = "cs_kinesis_shards_hits_total"
View Source
const LapiBouncerHitsMetricName = "cs_lapi_bouncer_requests_total"

hits per bouncer

View Source
const LapiMachineHitsMetricName = "cs_lapi_machine_requests_total"

hits per machine

View Source
const LapiNilDecisionsMetricName = "cs_lapi_decisions_ko_total"
keep track of the number of calls (per bouncer) that lead to nil/non-nil responses.

while it's not exact, it's a good way to know - when you have a rutpure bouncer - what is the rate of ok/ko answers you got from lapi

View Source
const LapiNonNilDecisionsMetricName = "cs_lapi_decisions_ok_total"

hits per bouncer

View Source
const LapiResponseTimeMetricName = "cs_lapi_request_duration_seconds"
View Source
const LapiRouteHitsMetricName = "cs_lapi_route_requests_total"
View Source
const LokiDataSourceLinesReadMetricName = "cs_lokisource_hits_total"
View Source
const NodesHitsKoMetricName = "cs_node_hits_ko_total"
View Source
const NodesHitsMetricName = "cs_node_hits_total"
View Source
const NodesHitsOkMetricName = "cs_node_hits_ok_total"
View Source
const NodesWlHitsMetricName = "cs_node_wl_hits_total"
View Source
const NodesWlHitsOkMetricName = "cs_node_wl_hits_ok_total"
View Source
const RegexpCacheMetricName = "cs_regexp_cache_size"
View Source
const S3DataSourceLinesReadMetricName = "cs_s3_hits_total"
View Source
const S3DataSourceObjectsReadMetricName = "cs_s3_objects_total"
View Source
const S3DataSourceSQSMessagesReceivedMetricName = "cs_s3_sqs_messages_total"
View Source
const SyslogDataSourceLinesParsedMetricName = "cs_syslogsource_parsed_total"
View Source
const SyslogDataSourceLinesReceivedMetricName = "cs_syslogsource_hits_total"
View Source
const VictorialogsDataSourceLinesReadMetricName = "cs_victorialogssource_hits_total"
View Source
const WineventlogDataSourceLinesReadMetricName = "cs_winevtlogsource_hits_total"

Variables

View Source
var AcquisitionMetricsNames = []string{}
View Source
var AppsecBlockCounter = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: AppsecBlockCounterMetricName,
		Help: "Total events blocked by the Application Security Engine.",
	},
	[]string{"source", "appsec_engine"},
)
View Source
var AppsecGlobalParsingHistogram = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Help:    "Time spent processing a request by the Application Security Engine.",
		Name:    AppsecGlobalParsingHistogramMetricName,
		Buckets: []float64{0.0001, 0.00025, 0.0005, 0.001, 0.0025, 0.0050, 0.01, 0.025, 0.05, 0.1, 0.25},
	},
	[]string{"source", "appsec_engine"},
)
View Source
var AppsecInbandParsingHistogram = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Help:    "Time spent processing a request by the inband Application Security Engine.",
		Name:    AppsecInbandParsingHistogramMetricName,
		Buckets: []float64{0.0001, 0.00025, 0.0005, 0.001, 0.0025, 0.0050, 0.01, 0.025, 0.05, 0.1, 0.25},
	},
	[]string{"source", "appsec_engine"},
)
View Source
var AppsecOutbandParsingHistogram = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Help:    "Time spent processing a request by the Application Security Engine.",
		Name:    AppsecOutbandParsingHistogramMetricName,
		Buckets: []float64{0.0001, 0.00025, 0.0005, 0.001, 0.0025, 0.0050, 0.01, 0.025, 0.05, 0.1, 0.25},
	},
	[]string{"source", "appsec_engine"},
)
View Source
var AppsecReqCounter = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: AppsecReqCounterMetricName,
		Help: "Total events processed by the Application Security Engine.",
	},
	[]string{"source", "appsec_engine"},
)
View Source
var AppsecRuleHits = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: AppsecRuleHitsMetricName,
		Help: "Count of triggered rule, by rule_name, type (inband/outofband), appsec_engine and source",
	},
	[]string{"rule_name", "type", "appsec_engine", "source"},
)
View Source
var BucketsCanceled = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: BucketsCanceledMetricName,
		Help: "Total buckets canceled.",
	},
	[]string{"name"},
)
View Source
var BucketsCurrentCount = prometheus.NewGaugeVec(
	prometheus.GaugeOpts{
		Name: BucketsCurrentCountMetricName,
		Help: "Number of buckets that currently exist.",
	},
	[]string{"name"},
)
View Source
var BucketsInstantiation = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: BucketsInstantiationMetricName,
		Help: "Total buckets were instantiated.",
	},
	[]string{"name"},
)
View Source
var BucketsOverflow = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: BucketsOverflowMetricName,
		Help: "Total buckets overflowed.",
	},
	[]string{"name"},
)
View Source
var BucketsPour = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: BucketPouredMetricName,
		Help: "Total events were poured in bucket.",
	},
	[]string{"source", "type", "name"},
)
View Source
var BucketsUnderflow = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: BucketsUnderflowMetricName,
		Help: "Total buckets underflowed.",
	},
	[]string{"name"},
)
View Source
var CacheMetrics = prometheus.NewGaugeVec(
	prometheus.GaugeOpts{
		Name: CacheMetricName,
		Help: "Entries per cache.",
	},
	[]string{"name", "type"},
)
View Source
var CloudWatchDatasourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: CloudWatchDatasourceLinesReadMetricName,
		Help: "Number of events read from stream.",
	},
	[]string{"group", "stream", "datasource_type", "acquis_type"},
)
View Source
var CloudWatchDatasourceOpenedStreams = prometheus.NewGaugeVec(
	prometheus.GaugeOpts{
		Name: CloudWatchDatasourceOpenedStreamsMetricName,
		Help: "Number of opened stream within group.",
	},
	[]string{"group"},
)
View Source
var DockerDatasourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: DockerDatasourceLinesReadMetricName,
		Help: "Total lines that were read.",
	},
	[]string{"source", "datasource_type", "acquis_type"})
View Source
var ErrInvalidMetricsLevel = errors.New("invalid metrics level")
View Source
var FileDatasourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: FileDatasourceLinesReadMetricName,
		Help: "Total lines that were read.",
	},
	[]string{"source", "datasource_type", "acquis_type"},
)
View Source
var GlobalActiveDecisions = prometheus.NewGaugeVec(
	prometheus.GaugeOpts{
		Name: GlobalActiveDecisionsMetricName,
		Help: "Number of active decisions.",
	},
	[]string{"reason", "origin", "action"},
)
View Source
var GlobalAlerts = prometheus.NewGaugeVec(
	prometheus.GaugeOpts{
		Name: GlobalAlertsMetricName,
		Help: "Number of alerts (excluding CAPI).",
	},
	[]string{"reason"},
)
View Source
var GlobalBucketPourKo = prometheus.NewCounter(
	prometheus.CounterOpts{
		Name: GlobalBucketPourKoMetricName,
		Help: "Total events were not poured in a bucket.",
	},
)
View Source
var GlobalBucketPourOk = prometheus.NewCounter(
	prometheus.CounterOpts{
		Name: GlobalBucketPourOkMetricName,
		Help: "Total events were poured in at least one bucket.",
	},
)
View Source
var GlobalCsInfo = prometheus.NewGauge(
	prometheus.GaugeOpts{
		Name:        GlobalCsInfoMetricName,
		Help:        "Information about Crowdsec.",
		ConstLabels: prometheus.Labels{"version": version.String()},
	},
)
View Source
var GlobalParserHits = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: GlobalParserHitsMetricName,
		Help: "Total events entered the parser.",
	},
	[]string{"source", "type"},
)
View Source
var GlobalParserHitsKo = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: GlobalParserHitsKoMetricName,
		Help: "Total events were unsuccessfully parsed.",
	},
	[]string{"source", "type", "acquis_type"},
)
View Source
var GlobalParserHitsOk = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: GlobalParserHitsOkMetricName,
		Help: "Total events were successfully parsed.",
	},
	[]string{"source", "type", "acquis_type"},
)
View Source
var GlobalParsingHistogram = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Help:    "Time spent parsing a line",
		Name:    GlobalParsingHistogramMetricName,
		Buckets: []float64{0.0005, 0.001, 0.0015, 0.002, 0.0025, 0.003, 0.004, 0.005, 0.0075, 0.01},
	},
	[]string{"type", "source"},
)
View Source
var GlobalPourHistogram = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Name:    GlobalPourHistogramMetricName,
		Help:    "Time spent pouring an event to buckets.",
		Buckets: []float64{0.001, 0.002, 0.005, 0.01, 0.015, 0.02, 0.03, 0.04, 0.05},
	},
	[]string{"type", "source"},
)
View Source
var HTTPDataSourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: HTTPDataSourceLinesReadMetricName,
		Help: "Total lines that were read from http source",
	},
	[]string{"path", "src", "datasource_type", "acquis_type"})
View Source
var JournalCtlDataSourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: JournalCtlDataSourceLinesReadMetricName,
		Help: "Total lines that were read.",
	},
	[]string{"source", "datasource_type", "acquis_type"})
View Source
var K8SAuditDataSourceEventCount = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: K8SAuditDataSourceEventCountMetricName,
		Help: "Total number of events received by k8s-audit source",
	},
	[]string{"source", "datasource_type", "acquis_type"})
View Source
var K8SAuditDataSourceRequestCount = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: K8SAuditDataSourceRequestCountMetricName,
		Help: "Total number of requests received",
	},
	[]string{"source"})
View Source
var KafkaDataSourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: KafkaDataSourceLinesReadMetricName,
		Help: "Total lines that were read from topic",
	},
	[]string{"topic", "datasource_type", "acquis_type"})
View Source
var KinesisDataSourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: KinesisDataSourceLinesReadMetricName,
		Help: "Number of events read per stream.",
	},
	[]string{"stream", "datasource_type", "acquis_type"},
)
View Source
var KinesisDataSourceLinesReadShards = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: KinesisDataSourceLinesReadShardsMetricName,
		Help: "Number of events read per shard.",
	},
	[]string{"stream", "shard"},
)
View Source
var LapiBouncerHits = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: LapiBouncerHitsMetricName,
		Help: "Number of calls to each route per method grouped by bouncers.",
	},
	[]string{"bouncer", "route", "method"},
)
View Source
var LapiMachineHits = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: LapiMachineHitsMetricName,
		Help: "Number of calls to each route per method grouped by machines.",
	},
	[]string{"machine", "route", "method"},
)
View Source
var LapiNilDecisions = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: LapiNilDecisionsMetricName,
		Help: "Number of calls to /decisions that returned nil result.",
	},
	[]string{"bouncer"},
)
View Source
var LapiNonNilDecisions = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: LapiNonNilDecisionsMetricName,
		Help: "Number of calls to /decisions that returned non-nil result.",
	},
	[]string{"bouncer"},
)
View Source
var LapiResponseTime = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Name:    LapiResponseTimeMetricName,
		Help:    "Response time of LAPI",
		Buckets: []float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.2, 0.3, 0.4, 0.5, 0.75, 1},
	},
	[]string{"endpoint", "method"},
)
View Source
var LapiRouteHits = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: LapiRouteHitsMetricName,
		Help: "Number of calls to each route per method.",
	},
	[]string{"route", "method"},
)
View Source
var LokiDataSourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: LokiDataSourceLinesReadMetricName,
		Help: "Total lines that were read.",
	},
	[]string{"source", "datasource_type", "acquis_type"})
View Source
var NodesHits = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: NodesHitsMetricName,
		Help: "Total events entered node.",
	},
	[]string{"source", "type", "name", "stage", "acquis_type"},
)
View Source
var NodesHitsKo = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: NodesHitsKoMetricName,
		Help: "Total events unsuccessfully exited node.",
	},
	[]string{"source", "type", "name", "stage", "acquis_type"},
)
View Source
var NodesHitsOk = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: NodesHitsOkMetricName,
		Help: "Total events successfully exited node.",
	},
	[]string{"source", "type", "name", "stage", "acquis_type"},
)
View Source
var NodesWlHits = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: NodesWlHitsMetricName,
		Help: "Total events processed by whitelist node.",
	},
	[]string{"source", "type", "name", "reason", "stage", "acquis_type"},
)
View Source
var NodesWlHitsOk = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: NodesWlHitsOkMetricName,
		Help: "Total events successfully whitelisted by node.",
	},
	[]string{"source", "type", "name", "reason", "stage", "acquis_type"},
)
View Source
var RegexpCacheMetrics = prometheus.NewGaugeVec(
	prometheus.GaugeOpts{
		Name: RegexpCacheMetricName,
		Help: "Entries per regexp cache.",
	},
	[]string{"name"},
)
View Source
var S3DataSourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: S3DataSourceLinesReadMetricName,
		Help: "Number of events read per bucket.",
	},
	[]string{"bucket", "datasource_type", "acquis_type"},
)
View Source
var S3DataSourceObjectsRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: S3DataSourceObjectsReadMetricName,
		Help: "Number of objects read per bucket.",
	},
	[]string{"bucket"},
)
View Source
var S3DataSourceSQSMessagesReceived = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: S3DataSourceSQSMessagesReceivedMetricName,
		Help: "Number of SQS messages received per queue.",
	},
	[]string{"queue"},
)
View Source
var SyslogDataSourceLinesParsed = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: SyslogDataSourceLinesParsedMetricName,
		Help: "Total lines that were successfully parsed",
	},
	[]string{"source", "type", "datasource_type", "acquis_type"})
View Source
var SyslogDataSourceLinesReceived = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: SyslogDataSourceLinesReceivedMetricName,
		Help: "Total lines that were received.",
	},
	[]string{"source", "datasource_type", "acquis_type"})
View Source
var VictorialogsDataSourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: VictorialogsDataSourceLinesReadMetricName,
		Help: "Total lines that were read.",
	},
	[]string{"source", "datasource_type", "acquis_type"})
View Source
var WineventlogDataSourceLinesRead = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: WineventlogDataSourceLinesReadMetricName,
		Help: "Total event that were read.",
	},
	[]string{"source", "datasource_type", "acquis_type"})

Functions

func RegisterAcquisitionMetric

func RegisterAcquisitionMetric(metricName string)

func RegisterMetrics

func RegisterMetrics(metricsLevel MetricsLevelConfig) error

Types

type AcquisitionMetricsLevel

type AcquisitionMetricsLevel int
const (
	AcquisitionMetricsLevelNone       AcquisitionMetricsLevel       = iota // No metrics
	AcquisitionMetricsLevelAggregated                                      // Aggregated metrics
	AcquisitionMetricsLevelFull                                            // Full metrics
	AcquisitionMetricsLevelDefault    = AcquisitionMetricsLevelFull        // Default metrics level
)

type MetricsLevelConfig

type MetricsLevelConfig string
const (
	MetricsLevelNone       MetricsLevelConfig = "none"
	MetricsLevelAggregated MetricsLevelConfig = "aggregated"
	MetricsLevelFull       MetricsLevelConfig = "full"
	// MetricsLevelDefault is the default metrics level.
	MetricsLevelDefault MetricsLevelConfig = MetricsLevelFull
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL