Skip to content

Commit

Permalink
feat: [code-2912]: improved log message for usage metrics workers (#3299
Browse files Browse the repository at this point in the history
)

* improved log message for usage metrics workers
  • Loading branch information
enver-bisevac authored and Harness committed Jan 20, 2025
1 parent eb77891 commit 72c5e2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/services/usage/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,19 @@ func newWorker(id int, queue *queue) *worker {
}

func (w *worker) start(ctx context.Context, fn func(context.Context, *Metric)) {
log.Ctx(ctx).Info().Int("worker", w.id).Msg("starting worker")
log.Ctx(ctx).Info().Int("usage-worker", w.id).Msg("usage metrics starting worker")
for {
select {
case <-ctx.Done():
log.Ctx(ctx).Err(ctx.Err()).Msg("context canceled")
return
case <-w.stopCh:
log.Ctx(ctx).Warn().Int("worker", w.id).Msg("worker is stopped")
log.Ctx(ctx).Warn().Int("usage-worker", w.id).Msg("worker is stopped")
return
default:
payload, err := w.queue.Pop(ctx)
if err != nil {
log.Ctx(ctx).Err(err).Msg("failed to consume the queue")
log.Ctx(ctx).Err(err).Int("usage-worker", w.id).Msg("failed to consume the queue")
return
}
fn(ctx, payload)
Expand Down

0 comments on commit 72c5e2b

Please sign in to comment.