Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Remove call to time.Now() on worker thread when handling record reqs (#…
Browse files Browse the repository at this point in the history
…1210)

Time is already recorded on the client side and stored in the currently unused recordReq.t
field. Avoiding these repeated calls to time.Now while the worker is blocked can significantly
reduce worker contention.
  • Loading branch information
ian-mi committed Jun 2, 2020
1 parent 46dfec7 commit cd9ae5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stats/view/worker_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (cmd *recordReq) handleCommand(w *worker) {
}
ref := w.getMeasureRef(m.Measure().Name())
for v := range ref.views {
v.addSample(cmd.tm, m.Value(), cmd.attachments, time.Now())
v.addSample(cmd.tm, m.Value(), cmd.attachments, cmd.t)
}
}
}
Expand Down

0 comments on commit cd9ae5c

Please sign in to comment.