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

Fix rpc.control metrics and reduce object creation #230

Merged
merged 1 commit into from
Apr 25, 2022

Conversation

dapplion
Copy link
Contributor

Metrics show that every RPC message we sent has a control in it, while only 0.02 received messages have a control. As shown with

rate(gossipsub_rpc_sent_control_total[$__rate_interval])
/
rate(gossipsub_rpc_sent_count_total[$__rate_interval])

The cause is that the control object is always created even when not necessary.

Description

  • Create control object only when necessary
  • Register control message when at least one array has at least one element

@dapplion dapplion requested a review from a team as a code owner April 22, 2022 20:59
@codecov-commenter
Copy link

codecov-commenter commented Apr 22, 2022

Codecov Report

Merging #230 (00b24f2) into master (fe07f20) will decrease coverage by 0.13%.
The diff coverage is 20.00%.

@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
- Coverage   79.05%   78.91%   -0.14%     
==========================================
  Files          24       24              
  Lines        7662     7661       -1     
  Branches      765      802      +37     
==========================================
- Hits         6057     6046      -11     
- Misses       1605     1615      +10     
Impacted Files Coverage Δ
ts/metrics.ts 22.94% <0.00%> (-0.14%) ⬇️
ts/index.ts 87.54% <25.00%> (-0.24%) ⬇️
ts/utils/create-gossip-rpc.ts 100.00% <100.00%> (ø)

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 fe07f20...00b24f2. Read the comment docs.

@wemeetagain wemeetagain merged commit 703ea64 into master Apr 25, 2022
@wemeetagain wemeetagain deleted the dapplion/rpc-metrics branch April 25, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants