-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lib/grandpa) implement grandpa finality round metrics #1655
Merged
EclesioMeloJunior
merged 20 commits into
development
from
eclesio/grandpa-final-round-metrics
Jul 6, 2021
Merged
Changes from 9 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4b12288
chore: implement grandpa finality round
EclesioMeloJunior ca68868
Merge branch 'development' into eclesio/grandpa-final-round-metrics
EclesioMeloJunior 681cfaf
pool ready transaction metrics
EclesioMeloJunior 5f62d09
chore: add priority queue metrics
EclesioMeloJunior 365b8d7
Merge branch 'development' into eclesio/ready-txs-metrics
EclesioMeloJunior 34b7c33
chore: fix lint
EclesioMeloJunior 58b9e99
Merge branch 'eclesio/ready-txs-metrics' into eclesio/grandpa-final-r…
EclesioMeloJunior 23c4f5b
chore: add gauge collector interface
EclesioMeloJunior fb7e3b2
Merge branch 'development' into eclesio/grandpa-final-round-metrics
EclesioMeloJunior c5c8076
Merge branch 'development' into eclesio/grandpa-final-round-metrics
EclesioMeloJunior 08d29c6
chore: solve conflicts
EclesioMeloJunior 1767fb4
Merge branch 'eclesio/grandpa-final-round-metrics' of github.com:Chai…
EclesioMeloJunior 89d7629
chore: fix lint
EclesioMeloJunior a1ed8ca
remove unused metrics timeout
EclesioMeloJunior 2b35f99
Merge branch 'development' into eclesio/grandpa-final-round-metrics
EclesioMeloJunior 24ab066
chore: remove unused test
EclesioMeloJunior 628f3db
remove unused consts
EclesioMeloJunior 55d3368
Merge branch 'development' into eclesio/grandpa-final-round-metrics
EclesioMeloJunior 2b3436a
chore: adding tests
EclesioMeloJunior b07413d
Merge branch 'development' into eclesio/grandpa-final-round-metrics
EclesioMeloJunior File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package metrics | ||
|
||
import ( | ||
"time" | ||
|
||
ethmetrics "github.com/ethereum/go-ethereum/metrics" | ||
) | ||
|
||
// GaugeCollector abstracts the Update function to collectors | ||
// just implement the collection | ||
type GaugeCollector interface { | ||
Update() int64 | ||
} | ||
|
||
// CollectGaugeMetrics receives an timeout, label and a gauge collector | ||
// and acquire the metrics timeout by timeout to a ethereum metrics gauge | ||
func CollectGaugeMetrics(timeout time.Duration, label string, c GaugeCollector) { | ||
t := time.NewTicker(timeout) | ||
defer t.Stop() | ||
|
||
collectGauge(label, c) | ||
|
||
for range t.C { | ||
collectGauge(label, c) | ||
} | ||
} | ||
|
||
func collectGauge(label string, c GaugeCollector) { | ||
ethmetrics.Enabled = true | ||
pooltx := ethmetrics.GetOrRegisterGauge(label, nil) | ||
pooltx.Update(c.Update()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have this defined in the
NewPool
constructor rather than package level const. You could even create a privatenewPool
that takes in configurable durations for this so you can adjust them in the tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed this and used the metrics default value