From 2b3ff1aa04a86acbad6b80cb179d4f78ee620d67 Mon Sep 17 00:00:00 2001 From: William Perron Date: Wed, 15 May 2024 15:29:07 -0400 Subject: [PATCH] improve instrumentation of internal notifier --- notify.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/notify.go b/notify.go index 2e52ed3..71f511d 100644 --- a/notify.go +++ b/notify.go @@ -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) }