Skip to content

Commit

Permalink
Remove call to time.Now() on worker thread when handling record reqs (c…
Browse files Browse the repository at this point in the history
…ensus-instrumentation#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 authored and evankanderson committed Jun 4, 2020
1 parent 46dfec7 commit a5a78ff
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 a5a78ff

Please sign in to comment.