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

Metrics measurement adjustment #511

Merged
merged 3 commits into from
Jan 7, 2019
Merged

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Jan 4, 2019

PR description

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

The total difficulty of mainnet is larger than a signed long, so we
need to adjust the way we get the number.
@@ -69,7 +70,9 @@ public DefaultMutableBlockchain(
MetricCategory.BLOCKCHAIN,
"difficulty_total",
"Total difficulty of the chainhead",
() -> (double) this.getChainHead().getTotalDifficulty().toLong());
() ->
new BigInteger(this.getChainHead().getTotalDifficulty().getBytes().getArrayUnsafe())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a utility for transforming BytesValues to BigInteger's: BytesValues.asUnsignedBigInteger(this.getChainHead().getTotalDifficulty().getBytes()).doubleValue()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting it on UInt256, which is why I stopped looking and rolled my own.

The total difficulty of mainnet is larger than a signed long, so we
need to adjust the way we get the number.
@shemnon shemnon merged commit 77d4bf6 into PegaSysEng:master Jan 7, 2019
@shemnon shemnon deleted the metrics branch January 7, 2019 16:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants