Pass aggregation group identifier through context

This commit is contained in:
Fabian Reinartz 2015-10-01 15:18:19 +02:00
parent d2a0a218aa
commit 03272174f2
2 changed files with 3 additions and 1 deletions

View File

@ -204,8 +204,9 @@ func (ag *aggrGroup) run(nf notifyFunc) {
// finish before terminating them. // finish before terminating them.
ctx, _ := context.WithTimeout(ag.ctx, ag.opts.GroupInterval) ctx, _ := context.WithTimeout(ag.ctx, ag.opts.GroupInterval)
// Populate context with the destination name. // Populate context with the destination name and group identifier.
ctx = context.WithValue(ctx, notify.NotifyName, ag.opts.SendTo) ctx = context.WithValue(ctx, notify.NotifyName, ag.opts.SendTo)
ctx = context.WithValue(ctx, notify.NotifyGroup, ag.String())
// Wait the configured interval before calling flush again. // Wait the configured interval before calling flush again.
ag.next.Reset(ag.opts.GroupInterval) ag.next.Reset(ag.opts.GroupInterval)

View File

@ -20,6 +20,7 @@ const (
NotifyName notifyKey = iota NotifyName notifyKey = iota
NotifyRepeatInterval NotifyRepeatInterval
NotifySendResolved NotifySendResolved
NotifyGroup
) )
type Notifier interface { type Notifier interface {