Skip to content

Conversation

@algorandskiy
Copy link
Contributor

Summary

Metrics counters where not cleared on close and lead to duplicate entries in metering report.

Test Plan

Added unit test. Tested manually.

Closes #3354

@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2022

Codecov Report

Merging #3661 (fad2a91) into master (468d34b) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3661      +/-   ##
==========================================
+ Coverage   48.12%   48.13%   +0.01%     
==========================================
  Files         381      381              
  Lines       62214    62223       +9     
==========================================
+ Hits        29939    29950      +11     
+ Misses      28847    28844       -3     
- Partials     3428     3429       +1     
Impacted Files Coverage Δ
ledger/metrics.go 100.00% <100.00%> (ø)
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
crypto/merkletrie/node.go 91.62% <0.00%> (-1.87%) ⬇️
cmd/tealdbg/debugger.go 71.42% <0.00%> (-0.99%) ⬇️
network/wsPeer.go 68.33% <0.00%> (-0.56%) ⬇️
catchup/service.go 68.88% <0.00%> (+0.24%) ⬆️
network/wsNetwork.go 63.09% <0.00%> (+0.29%) ⬆️
network/requestTracker.go 71.12% <0.00%> (+0.86%) ⬆️
data/transactions/verify/txn.go 45.02% <0.00%> (+0.86%) ⬆️
ledger/blockqueue.go 85.05% <0.00%> (+2.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 468d34b...fad2a91. Read the comment docs.

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

I'm not opposing to this change, but please make sure to look into Registry.Deregister; it looks like it not thread-safe.

@algorandskiy
Copy link
Contributor Author

close() is under l.trackerMu lock. And noone else deregisters any counter.
I guess making the registry thread safe is a separate issue.

@algorandskiy
Copy link
Contributor Author

Looks like Deregister simply missed the mutex op since the mutex does exist in Registry and used in Register. Fixed.

@tsachiherman tsachiherman changed the title metrics tracker: deregister on close algod : deregister metrics tracker on close Feb 22, 2022
@tsachiherman tsachiherman merged commit eab243f into algorand:master Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

algod_ledger_round duplicated in /metrics after running fast catchup

3 participants