Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2574)

Issue 558740043: Adds the agent uptime field to the agent pulse. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years, 11 months ago by alanmorales
Modified:
4 years, 11 months ago
Reviewers:
akaiser
CC:
opt-crs_google.com
Visibility:
Public.

Description

Adds the agent uptime field to the agent pulse. Uses the ticker to determine the number of milliseconds it should send.

Patch Set 1 #

Total comments: 2

Patch Set 2 : Calculating uptime using simple time.Now() #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -31 lines) Patch
M agent/control/pulse.go View 1 3 chunks +5 lines, -0 lines 1 comment Download
M agent/control/pulse_test.go View 1 4 chunks +7 lines, -9 lines 0 comments Download
M proto/control_go_proto/control.pb.go View 2 chunks +2 lines, -2 lines 0 comments Download
M proto/pulse.proto View 1 1 chunk +1 line, -0 lines 0 comments Download
M proto/pulse_go_proto/pulse.pb.go View 3 chunks +30 lines, -20 lines 0 comments Download

Messages

Total messages: 12
alanmorales
Please take a look, thanks!
4 years, 11 months ago (2019-05-08 20:36:09 UTC) #1
akaiser
https://codereview.appspot.com/558740043/diff/552670043/agent/control/pulse.go File agent/control/pulse.go (right): https://codereview.appspot.com/558740043/diff/552670043/agent/control/pulse.go#newcode108 agent/control/pulse.go:108: uptimeMs := ps.statsTracker.TickCount() * int64(pulseFrequency/time.Millisecond) The usage of the ...
4 years, 11 months ago (2019-05-08 20:48:24 UTC) #2
alanmorales
On 2019/05/08 20:48:24, akaiser wrote: > https://codereview.appspot.com/558740043/diff/552670043/agent/control/pulse.go > File agent/control/pulse.go (right): > > https://codereview.appspot.com/558740043/diff/552670043/agent/control/pulse.go#newcode108 > ...
4 years, 11 months ago (2019-05-08 22:06:58 UTC) #3
akaiser
On 2019/05/08 22:06:58, alanmorales wrote: > On 2019/05/08 20:48:24, akaiser wrote: > > https://codereview.appspot.com/558740043/diff/552670043/agent/control/pulse.go > ...
4 years, 11 months ago (2019-05-08 22:27:26 UTC) #4
akaiser
4 years, 11 months ago (2019-05-08 22:27:42 UTC) #5
alanmorales
Please take another look, using time.Now() to calculate agent uptime.
4 years, 11 months ago (2019-05-09 17:16:43 UTC) #6
akaiser
LGTM This is much cleaner, thank you. I had on comment about the units, but ...
4 years, 11 months ago (2019-05-09 17:28:37 UTC) #7
alanmorales
On 2019/05/09 17:28:37, akaiser wrote: > LGTM > This is much cleaner, thank you. I ...
4 years, 11 months ago (2019-05-09 17:36:25 UTC) #8
akaiser
On 2019/05/09 17:36:25, alanmorales wrote: > On 2019/05/09 17:28:37, akaiser wrote: > > LGTM > ...
4 years, 11 months ago (2019-05-09 17:40:42 UTC) #9
alanmorales
On 2019/05/09 17:40:42, akaiser wrote: > On 2019/05/09 17:36:25, alanmorales wrote: > > On 2019/05/09 ...
4 years, 11 months ago (2019-05-10 16:06:44 UTC) #10
alanmorales
On 2019/05/09 17:40:42, akaiser wrote: > On 2019/05/09 17:36:25, alanmorales wrote: > > On 2019/05/09 ...
4 years, 11 months ago (2019-05-10 16:06:46 UTC) #11
akaiser
4 years, 11 months ago (2019-05-10 16:50:41 UTC) #12
On 2019/05/10 16:06:46, alanmorales wrote:
> On 2019/05/09 17:40:42, akaiser wrote:
> > On 2019/05/09 17:36:25, alanmorales wrote:
> > > On 2019/05/09 17:28:37, akaiser wrote:
> > > > LGTM
> > > > This is much cleaner, thank you. I had on comment about the units, but
> I'll
> > > let
> > > > you decide whether you want to address it or not.
> > > > 
> > > >
> >
https://codereview.appspot.com/558740043/diff/572680043/agent/control/pulse.go
> > > > File agent/control/pulse.go (right):
> > > > 
> > > >
> > >
> >
>
https://codereview.appspot.com/558740043/diff/572680043/agent/control/pulse.g...
> > > > agent/control/pulse.go:119: AgentUptimeMs:        
> > > > int64(time.Now().Sub(ps.startTime).Seconds() * 1000),
> > > > I won't block your change on this, but if we're only ever going to
provide
> > > > second granularity then we should have made the AgentUptime proto
message
> in
> > > > seconds rather than milliseconds. 
> > > > 
> > > > I'd be really surprised if "time.Now().Sub(ps.startTime).Nanoseconds() /
> > > > 1000000" ever had any measurable performance impact on the Agent,
> especially
> > > > considering this is a calculation we perform once every ten seconds. If
> this
> > > is
> > > > a super performance critical loop then worring about a division makes
> sense,
> > > but
> > > > for something that happens so infrequently in "human time", IMO this is
a
> > > > premature optimization.
> > > 
> > > Sounds good, I actually think .Seconds returns a floating point which
> includes
> > > miliseconds (the go playground also seems to return floating points,
> > indicating
> > > fractions of second) so it should really give more than second per second
> > > precision. I've added a comment to clarify this.
> > 
> > SGTM. I just looked it up and the Seconds() function has a division in it
too:
> > https://golang.org/src/time/time.go?s=25511:25546#L796
> 
> Mildly interesting, but I was interested in seeing if the compiler would
compile
> Nanos() / 10000 and Seconds() * 1000 differently or if it would effectively
> detect that they were the same. Turns out they're mostly the same except for
an
> extra MOV instruction when using Seconds() ^.^ (but in fact, the arithmetic is
> the same)
> 
> In case you're interested:
>
https://drive.google.com/file/d/1bOnwK5ujwrDJEUK4HM1PWQMu1xwmfjN4/view?usp=sh...

Neat. I keep forgetting that Seconds() returns a float, so it isn't necessarily
losing any precision.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b