Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Metrics measurement adjustment (#511)
Browse files Browse the repository at this point in the history
The total difficulty of mainnet is larger than a signed long, so we
need to adjust the way we get the number.
  • Loading branch information
shemnon authored Jan 7, 2019
1 parent f576c52 commit 77d4bf6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import tech.pegasys.pantheon.metrics.MetricCategory;
import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.util.Subscribers;
import tech.pegasys.pantheon.util.bytes.BytesValues;
import tech.pegasys.pantheon.util.uint.UInt256;

import java.util.ArrayList;
Expand Down Expand Up @@ -69,7 +70,9 @@ public DefaultMutableBlockchain(
MetricCategory.BLOCKCHAIN,
"difficulty_total",
"Total difficulty of the chainhead",
() -> (double) this.getChainHead().getTotalDifficulty().toLong());
() ->
BytesValues.asUnsignedBigInteger(this.getChainHead().getTotalDifficulty().getBytes())
.doubleValue());
}

@Override
Expand Down

0 comments on commit 77d4bf6

Please sign in to comment.