Skip to content

Commit

Permalink
Make sure uptime positive
Browse files Browse the repository at this point in the history
  • Loading branch information
LuQQiu committed Feb 21, 2020
1 parent 7a262f1 commit 30fd417
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ protected void registerThroughputGauge(String counterName, String throughputName
new Gauge<Object>() {
@Override
public Object getValue() {
long uptime = (mClock.millis() - mMetricsStore.getLastClearTime())
// Divide into two lines so uptime is always zero or positive
long lastClearTime = mMetricsStore.getLastClearTime();
long uptime = (mClock.millis() - lastClearTime)
/ Constants.MINUTE_MS;
long value = MetricsSystem.counter(counterName).getCount();
// The value is bytes per minute
Expand Down

0 comments on commit 30fd417

Please sign in to comment.