Skip to content
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

Update attestation inclusion percentage log to use percentages #4916

Closed
terencechain opened this issue Feb 20, 2020 · 3 comments
Closed

Update attestation inclusion percentage log to use percentages #4916

terencechain opened this issue Feb 20, 2020 · 3 comments
Labels
Good First Issue Good for newcomers Help Wanted Extra attention is needed

Comments

@terencechain
Copy link
Member

terencechain commented Feb 20, 2020

Validator log where it says attestationInclusionPercentage=1.00 correctlyVotedHeadPercentage=0.00 correctlyVotedSourcePercentage=1.00 correctlyVotedTargetPercentage=1.00 should be percentage 100% not decimal point 1.00

Opening this issue to update the log to percentage presentation.
Here is the line:
https://github.com/prysmaticlabs/prysm/blob/master/validator/client/validator_metrics.go#L115

@terencechain terencechain added Help Wanted Extra attention is needed Good First Issue Good for newcomers labels Feb 20, 2020
@ShawkiS
Copy link
Contributor

ShawkiS commented Apr 20, 2020

I am going to add this function to the mathutil:
func Percent(current, maximum float64) int { percentage := float64(current) / float64(maximum) * float64(100) return int(percentage / float64(10)) }

The test shape is:
func TestPercent(t *testing.T) { tests := []struct { a uint64 b uint64 result uint64 }{ { a: 20, b: 40, result: 50, } } for _, tt := range tests { if tt.result != mathutil.Percent(tt.a, tt.b) { t.Fatalf("Percent(%d) = %d, wanted: %d", tt.a, mathutil.Percent(tt.a, tt.b), tt.result) } } }

And use it here: https://github.com/prysmaticlabs/prysm/blob/master/validator/client/validator_metrics.go#L115

Shall I implement it?

@terencechain
Copy link
Member Author

Already done in #5527 and we don't really need an extra helper for it. Closing the issue now. Thanks for looking at this one 🙏🏻

@prestonvanloon
Copy link
Member

prestonvanloon commented Apr 21, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for newcomers Help Wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants