Skip to content

Commit

Permalink
Avoid returning NaN when requesting for count metrics per second and …
Browse files Browse the repository at this point in the history
…no metrics have been recorded

This is mainly to avoid failing execution when trying to deserialize the statistics from dotnet dsl.
  • Loading branch information
rabelenda-abstracta committed Feb 5, 2024
1 parent 877d7cf commit f8df6ec
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void increment(long inc, long elapsedTimeMillis) {
* Provides the average count per second for the given metric.
*/
public double perSecond() {
return val / ((double) elapsedTimeMillis / 1000);
return elapsedTimeMillis != 0 ? val / ((double) elapsedTimeMillis / 1000) : 0;
}

/**
Expand Down

0 comments on commit f8df6ec

Please sign in to comment.