improve instrumentation of internal notifier

main
William Perron 6 months ago
parent 18165a827c
commit 2b3ff1aa04
No known key found for this signature in database
GPG Key ID: F701727E6034EEC9

@ -76,7 +76,6 @@ func (n *Notifier) Send(ctx context.Context) {
n.c <- ctx
}
// TODO(wperron) is there a (nice) way to instrument this function?
func (n *Notifier) NotifyFunc(ctx context.Context, f func(context.Context)) {
for {
select {
@ -84,8 +83,11 @@ func (n *Notifier) NotifyFunc(ctx context.Context, f func(context.Context)) {
log.Debug().Msg("context deadline exceeded, exiting notify func")
return
case innerCtx := <-n.c:
innerCtx, span := tracer.Start(innerCtx, "notify_func")
log.Debug().Ctx(innerCtx).Msg("tick received, notifying function")
f(innerCtx)
span.End()
}
time.Sleep(time.Second)
}

Loading…
Cancel
Save