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

[Networking] Wires in GossipSub observability #3643

Merged
merged 11 commits into from
Dec 1, 2022

Conversation

thep2p
Copy link
Contributor

@thep2p thep2p commented Dec 1, 2022

This PR upgrades pubsub dependency to include our upstreamed changes for RPC inspector libp2p/go-libp2p-pubsub#509, and then implements a GossipSub observability component that logs and records the metrics around the incoming RPCs.

Sample log:

{"level":"trace","node_id":"edf3d73d85af9e1057aa2250d7dffa10c5a6c624e4256427dd766a0ccc5ec24f","module":"gossipsub-control-message-metrics","peer_id":"16Uiu2HAkxPnKTzPeSAHv1fb6UwVtA1Q6ttwEr8SNvXvt4SUvisod","iHaveCount":0,"iWantCount":0,"graftCount":0,"pruneCount":0,"included_message_count":1,"time":"2022-12-01T18:28:14Z","message":"received rpc with control messages"}

logger zerolog.Logger
}

func NewObservableGossipSub(h host.Host, metrics module.GossipSubRouterMetrics, logger zerolog.Logger) *ObservableGossipSubRouter {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This component has been renamed and refactored to GossipSubControlMessageMetrics

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2022

Codecov Report

Merging #3643 (cdf5ec8) into master (7d643c6) will increase coverage by 0.04%.
The diff coverage is 43.75%.

@@            Coverage Diff             @@
##           master    #3643      +/-   ##
==========================================
+ Coverage   55.26%   55.30%   +0.04%     
==========================================
  Files         756      756              
  Lines       69525    69488      -37     
==========================================
+ Hits        38420    38428       +8     
+ Misses      27955    27908      -47     
- Partials     3150     3152       +2     
Flag Coverage Δ
unittests 55.30% <43.75%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
network/p2p/p2pnode/gossipsubMetrics.go 43.75% <43.75%> (ø)
...ratelimit/internal/limiter_map/rate_limiter_map.go 76.00% <0.00%> (-2.67%) ⬇️
engine/access/apiproxy/access_api_proxy.go 15.44% <0.00%> (-1.63%) ⬇️
state/protocol/badger/state.go 52.65% <0.00%> (-0.67%) ⬇️
ledger/complete/wal/checkpointer.go 63.35% <0.00%> (-0.27%) ⬇️
admin/command_runner.go 82.38% <0.00%> (ø)
engine/consensus/compliance/core.go 74.60% <0.00%> (ø)
fvm/environment/contract_updater.go 66.88% <0.00%> (ø)
state/protocol/badger/validity.go 48.96% <0.00%> (+1.24%) ⬆️
consensus/hotstuff/eventloop/event_loop.go 74.82% <0.00%> (+1.36%) ⬆️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

FVM Benchstat comparison

This branch with compared with the base branch onflow:master commit 7d643c6

The command (for i in {1..7}; do go test ./fvm ./engine/execution/computation --bench . --tags relic -shuffle=on --benchmem --run ^$; done) was used.

Collapsed results for better readability

old.txtnew.txt
time/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-230.9ms ± 2%30.4ms ± 4%~(p=0.234 n=6+7)
RuntimeTransaction/convert_int_to_string-232.5ms ± 2%36.3ms ±16%~(p=0.053 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-236.0ms ±19%34.4ms ± 2%~(p=0.534 n=7+6)
RuntimeTransaction/get_signer_address-231.9ms ± 2%31.3ms ± 3%~(p=0.051 n=6+7)
RuntimeTransaction/get_public_account-234.0ms ± 3%34.3ms ± 4%~(p=0.628 n=6+7)
RuntimeTransaction/get_account_and_get_balance-2294ms ± 2%293ms ± 1%~(p=0.366 n=7+6)
RuntimeTransaction/get_account_and_get_available_balance-2262ms ± 3%265ms ± 1%~(p=0.295 n=7+6)
RuntimeTransaction/get_account_and_get_storage_used-235.6ms ± 4%35.6ms ± 4%~(p=0.902 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-2230ms ± 1%232ms ± 5%~(p=0.165 n=7+7)
RuntimeTransaction/get_signer_vault-237.9ms ± 5%38.1ms ± 1%~(p=0.394 n=6+6)
RuntimeTransaction/get_signer_receiver-248.0ms ± 4%47.5ms ± 4%~(p=0.535 n=7+7)
RuntimeTransaction/transfer_tokens-2200ms ± 2%204ms ± 3%~(p=0.165 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-237.0ms ± 4%37.1ms ± 4%~(p=1.000 n=7+6)
RuntimeTransaction/load_and_save_long_string_on_signers_address-277.6ms ± 5%77.0ms ± 3%~(p=0.620 n=7+7)
RuntimeTransaction/create_new_account-2815ms ± 1%823ms ± 2%~(p=0.138 n=6+7)
RuntimeTransaction/call_empty_contract_function-234.3ms ± 3%34.5ms ± 2%~(p=0.534 n=7+6)
RuntimeTransaction/emit_event-246.7ms ± 5%45.8ms ± 3%~(p=0.259 n=7+7)
RuntimeTransaction/borrow_array_from_storage-2133ms ± 2%135ms ± 3%~(p=0.366 n=6+7)
RuntimeTransaction/copy_array_from_storage-2139ms ± 2%138ms ± 2%~(p=0.836 n=7+6)
RuntimeNFTBatchTransfer-2115ms ± 4%118ms ± 7%~(p=0.259 n=7+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-24.34s ± 2%4.31s ± 4%~(p=0.535 n=7+7)
 
computationdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-2202 ± 0%202 ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2502 ± 0%502 ± 0%~(all equal)
RuntimeTransaction/get_signer_address-2302 ± 0%302 ± 0%~(all equal)
RuntimeTransaction/get_public_account-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_balance-21.00k ± 0%1.00k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_available_balance-22.60k ± 0%2.60k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-21.30k ± 0%1.30k ± 0%~(all equal)
RuntimeTransaction/get_signer_vault-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_signer_receiver-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/transfer_tokens-23.50k ± 0%3.50k ± 0%~(all equal)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/create_new_account-2202 ± 0%202 ± 0%~(all equal)
RuntimeTransaction/call_empty_contract_function-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/emit_event-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/borrow_array_from_storage-22.60k ± 0%2.60k ± 0%~(all equal)
RuntimeTransaction/copy_array_from_storage-22.60k ± 0%2.60k ± 0%~(all equal)
 
interactionsdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/get_signer_address-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/get_public_account-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_balance-216.7M ± 0%16.7M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_available_balance-25.13M ± 0%5.13M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-25.13M ± 0%5.13M ± 0%~(all equal)
RuntimeTransaction/get_signer_vault-244.5k ± 0%44.5k ± 0%~(all equal)
RuntimeTransaction/get_signer_receiver-244.9k ± 0%44.9k ± 0%~(all equal)
RuntimeTransaction/transfer_tokens-245.2k ± 0%45.2k ± 0%~(all equal)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-244.4k ± 0%44.4k ± 0%~(all equal)
RuntimeTransaction/load_and_save_long_string_on_signers_address-247.2k ± 0%47.2k ± 0%~(all equal)
RuntimeTransaction/create_new_account-28.39M ± 0%8.39M ± 0%~(all equal)
RuntimeTransaction/call_empty_contract_function-244.5k ± 0%44.5k ± 0%~(all equal)
RuntimeTransaction/emit_event-244.5k ± 0%44.5k ± 0%~(all equal)
RuntimeTransaction/borrow_array_from_storage-249.7k ± 0%49.7k ± 0%~(all equal)
RuntimeTransaction/copy_array_from_storage-249.7k ± 0%49.7k ± 0%~(all equal)
 
alloc/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_account_and_get_storage_capacity-297.8MB ± 2%99.8MB ± 2%+2.05%(p=0.017 n=7+7)
RuntimeTransaction/reference_tx-233.7MB ± 3%34.0MB ± 2%~(p=0.383 n=7+7)
RuntimeTransaction/convert_int_to_string-234.5MB ± 2%34.6MB ± 4%~(p=0.902 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-235.3MB ± 5%34.8MB ± 2%~(p=0.456 n=7+7)
RuntimeTransaction/get_signer_address-234.3MB ± 2%34.0MB ± 3%~(p=0.259 n=7+7)
RuntimeTransaction/get_public_account-235.4MB ± 4%35.3MB ± 1%~(p=0.805 n=7+7)
RuntimeTransaction/get_account_and_get_balance-2119MB ± 3%121MB ± 1%~(p=0.073 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-2104MB ± 2%105MB ± 1%~(p=0.383 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-235.4MB ± 1%35.4MB ± 3%~(p=1.000 n=6+7)
RuntimeTransaction/get_signer_vault-236.2MB ± 4%35.7MB ± 5%~(p=0.209 n=7+7)
RuntimeTransaction/get_signer_receiver-239.9MB ± 5%39.4MB ± 7%~(p=0.620 n=7+7)
RuntimeTransaction/transfer_tokens-282.2MB ± 4%84.3MB ± 3%~(p=0.128 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-235.2MB ± 3%34.5MB ± 3%~(p=0.051 n=7+6)
RuntimeTransaction/load_and_save_long_string_on_signers_address-252.6MB ± 5%51.5MB ± 3%~(p=0.318 n=7+7)
RuntimeTransaction/create_new_account-2185MB ± 2%186MB ± 1%~(p=0.318 n=7+7)
RuntimeTransaction/call_empty_contract_function-235.2MB ± 2%34.7MB ± 3%~(p=0.209 n=7+7)
RuntimeTransaction/emit_event-239.1MB ± 5%38.2MB ± 3%~(p=0.097 n=7+7)
RuntimeTransaction/borrow_array_from_storage-267.6MB ± 6%68.3MB ± 3%~(p=0.710 n=7+7)
RuntimeTransaction/copy_array_from_storage-279.9MB ± 2%79.9MB ± 2%~(p=1.000 n=7+7)
RuntimeNFTBatchTransfer-253.3MB ± 5%53.4MB ± 6%~(p=1.000 n=7+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-21.11GB ± 0%1.10GB ± 1%~(p=0.053 n=7+7)
 
allocs/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-274.4k ± 0%74.4k ± 0%~(p=0.728 n=7+7)
RuntimeTransaction/convert_int_to_string-286.6k ± 0%86.6k ± 0%~(p=0.298 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-297.8k ± 0%97.8k ± 0%~(p=0.267 n=7+7)
RuntimeTransaction/get_signer_address-278.6k ± 0%78.6k ± 0%~(p=0.639 n=7+7)
RuntimeTransaction/get_public_account-2100k ± 0%100k ± 0%~(p=0.155 n=7+6)
RuntimeTransaction/get_account_and_get_balance-21.31M ± 0%1.31M ± 0%~(p=0.477 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-21.19M ± 0%1.19M ± 0%~(p=0.779 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-2110k ± 0%110k ± 0%~(p=0.762 n=6+7)
RuntimeTransaction/get_account_and_get_storage_capacity-21.07M ± 0%1.07M ± 0%~(p=1.000 n=7+7)
RuntimeTransaction/get_signer_vault-2117k ± 0%117k ± 0%~(p=0.481 n=7+7)
RuntimeTransaction/get_signer_receiver-2188k ± 0%188k ± 0%~(p=0.646 n=7+7)
RuntimeTransaction/transfer_tokens-2840k ± 0%840k ± 0%~(p=0.688 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2117k ± 0%117k ± 0%~(p=0.878 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2192k ± 0%192k ± 0%~(p=1.000 n=7+7)
RuntimeTransaction/create_new_account-22.27M ± 0%2.27M ± 0%~(p=0.710 n=7+7)
RuntimeTransaction/call_empty_contract_function-288.8k ± 0%88.8k ± 0%~(p=0.820 n=7+7)
RuntimeTransaction/emit_event-2127k ± 0%127k ± 0%~(p=0.833 n=7+7)
RuntimeTransaction/borrow_array_from_storage-2330k ± 0%330k ± 0%~(p=0.902 n=7+7)
RuntimeTransaction/copy_array_from_storage-2286k ± 0%286k ± 0%~(p=0.874 n=7+7)
RuntimeNFTBatchTransfer-2263k ± 0%263k ± 0%~(p=0.732 n=6+6)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-215.8M ± 0%15.8M ± 0%~(p=0.073 n=7+7)
 
us/txdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-22.12k ± 2%2.10k ± 4%~(p=0.535 n=7+7)
 

Copy link
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

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

looks good!

@thep2p thep2p merged commit 51d22c6 into master Dec 1, 2022
@thep2p thep2p deleted the yahya/wire-observable-gossipsub branch December 1, 2022 22:35
peterargue pushed a commit that referenced this pull request Dec 1, 2022
* upgrades pubsub version

* upgrades go sum

* refactors observable gossipsub into metrics

* wires up metrics

* renames

* switches the log level

* go mod tidy
peterargue pushed a commit that referenced this pull request Dec 9, 2022
* upgrades pubsub version

* upgrades go sum

* refactors observable gossipsub into metrics

* wires up metrics

* renames

* switches the log level

* go mod tidy
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