Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pipeline/antispam/antispammer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Antispammer struct {

// antispammer metrics
activeMetric prometheus.Gauge
banMetric metric.HeldGaugeVec
banMetric *prometheus.GaugeVec
exceptionMetric *prometheus.CounterVec
}

Expand Down Expand Up @@ -57,8 +57,6 @@ func NewAntispammer(o *Options) *Antispammer {
zap.Duration("maintenance", o.MaintenanceInterval))
}

banMetric := o.MetricsController.RegisterGaugeVec("antispam_banned", "Source is banned", "source_name")

a := &Antispammer{
unbanIterations: o.UnbanIterations,
threshold: o.Threshold,
Expand All @@ -69,7 +67,10 @@ func NewAntispammer(o *Options) *Antispammer {
activeMetric: o.MetricsController.RegisterGauge("antispam_active",
"Gauge indicates whether the antispam is enabled",
),
banMetric: o.MetricHolder.AddGaugeVec(banMetric),
banMetric: o.MetricsController.RegisterGaugeVec("antispam_banned",
"Source is banned",
"source_name",
),
exceptionMetric: o.MetricsController.RegisterCounterVec("antispam_exceptions",
"How many times an exception match with an event",
"name",
Expand Down Expand Up @@ -157,6 +158,7 @@ func (a *Antispammer) Maintenance() {

if x == 0 {
delete(a.sources, sourceID)
a.banMetric.DeleteLabelValues(source.name)
continue
}

Expand Down