Metrics measurement adjustment (#511)

The total difficulty of mainnet is larger than a signed long, so we
need to adjust the way we get the number.

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Danno Ferrin 6 years ago committed by GitHub
parent 26383720d0
commit c545ff40b6
  1. 5
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/db/DefaultMutableBlockchain.java

@ -32,6 +32,7 @@ import tech.pegasys.pantheon.ethereum.util.InvalidConfigurationException;
import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricCategory;
import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.util.Subscribers; import tech.pegasys.pantheon.util.Subscribers;
import tech.pegasys.pantheon.util.bytes.BytesValues;
import tech.pegasys.pantheon.util.uint.UInt256; import tech.pegasys.pantheon.util.uint.UInt256;
import java.util.ArrayList; import java.util.ArrayList;
@ -69,7 +70,9 @@ public class DefaultMutableBlockchain implements MutableBlockchain {
MetricCategory.BLOCKCHAIN, MetricCategory.BLOCKCHAIN,
"difficulty_total", "difficulty_total",
"Total difficulty of the chainhead", "Total difficulty of the chainhead",
() -> (double) this.getChainHead().getTotalDifficulty().toLong()); () ->
BytesValues.asUnsignedBigInteger(this.getChainHead().getTotalDifficulty().getBytes())
.doubleValue());
} }
@Override @Override

Loading…
Cancel
Save