add labels

This commit is contained in:
sabban 2022-08-24 10:52:05 +02:00
parent e46ca38cbb
commit ee58a9aefb
2 changed files with 3 additions and 0 deletions

View file

@ -70,6 +70,7 @@ type Leaky struct {
wgPour *sync.WaitGroup wgPour *sync.WaitGroup
wgDumpState *sync.WaitGroup wgDumpState *sync.WaitGroup
mutex *sync.Mutex //used only for TIMEMACHINE mode to allow garbage collection without races mutex *sync.Mutex //used only for TIMEMACHINE mode to allow garbage collection without races
labels map[string]string
} }
var BucketsPour = prometheus.NewCounterVec( var BucketsPour = prometheus.NewCounterVec(
@ -177,6 +178,7 @@ func FromFactory(bucketFactory BucketFactory) *Leaky {
tomb: bucketFactory.tomb, tomb: bucketFactory.tomb,
wgPour: bucketFactory.wgPour, wgPour: bucketFactory.wgPour,
wgDumpState: bucketFactory.wgDumpState, wgDumpState: bucketFactory.wgDumpState,
labels: bucketFactory.Labels,
mutex: &sync.Mutex{}, mutex: &sync.Mutex{},
} }
if l.BucketConfig.Capacity > 0 && l.BucketConfig.leakspeed != time.Duration(0) { if l.BucketConfig.Capacity > 0 && l.BucketConfig.leakspeed != time.Duration(0) {

View file

@ -265,6 +265,7 @@ func NewAlert(leaky *Leaky, queue *Queue) (types.RuntimeAlert, error) {
StartAt: &startAt, StartAt: &startAt,
StopAt: &stopAt, StopAt: &stopAt,
Simulated: &leaky.Simulated, Simulated: &leaky.Simulated,
Labels: &leaky.labels,
} }
if leaky.BucketConfig == nil { if leaky.BucketConfig == nil {
return runtimeAlert, fmt.Errorf("leaky.BucketConfig is nil") return runtimeAlert, fmt.Errorf("leaky.BucketConfig is nil")