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

metrics: collect total netdev sent/received bytes #6108

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Aug 22, 2024

Summary

Expose total number of bytes sent/received on network interfaces. This is similar to node_exporter data but works without node_exporter. It is gated behind the EnableNetDevMetrics new config option.

Test Plan

Tested locally on both MacOS and Linux

# HELP algod_netdev_received_bytes Bytes received
# TYPE algod_netdev_received_bytes counter
algod_netdev_received_bytes{iface="lo0"} 1085390848
algod_netdev_received_bytes{iface="ap1"} 0
algod_netdev_received_bytes{iface="en0"} 1231844352
algod_netdev_received_bytes{iface="awdl0"} 2465792
algod_netdev_received_bytes{iface="utun0"} 0
algod_netdev_received_bytes{iface="utun1"} 0
algod_netdev_received_bytes{iface="utun2"} 0
# HELP algod_netdev_sent_bytes Bytes sent
# TYPE algod_netdev_sent_bytes counter
algod_netdev_sent_bytes{iface="lo0"} 1085390848
algod_netdev_sent_bytes{iface="ap1"} 3752960
algod_netdev_sent_bytes{iface="en0"} 1833891840
algod_netdev_sent_bytes{iface="awdl0"} 28672
algod_netdev_sent_bytes{iface="utun0"} 2048
algod_netdev_sent_bytes{iface="utun1"} 2048
algod_netdev_sent_bytes{iface="utun2"} 2048

We also have some tools to render and summarize these tagged metrics:

python3 test/heapwatch/metrics_aggs.py -d metrics/500x15 '--nick-re=name_r\d+' algod_netdev_sent_bytes -s html -t iface=ens5 --avg-max-min

Or non-tagged ones to CVS

python3 /bdevscripts/metric_csv.py metrics/500x15 algod_network_p2p_received_bytes_total relay | tail -1 | awk -F',' '{for(i=1;i<=NF;i++) sum+=$i; printf "%d\n", sum/NF}'

Copy link

codecov bot commented Aug 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 70 lines in your changes missing coverage. Please review.

Project coverage is 56.19%. Comparing base (8e2e2e4) to head (a20f4ee).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
util/metrics/netdev_common.go 0.00% 37 Missing ⚠️
util/metrics/netdev_linux.go 0.00% 31 Missing ⚠️
daemon/algod/server.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6108      +/-   ##
==========================================
- Coverage   56.22%   56.19%   -0.04%     
==========================================
  Files         490      492       +2     
  Lines       69705    69775      +70     
==========================================
+ Hits        39191    39207      +16     
- Misses      27840    27898      +58     
+ Partials     2674     2670       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@algorandskiy algorandskiy self-assigned this Aug 22, 2024
@algorandskiy algorandskiy force-pushed the pavel/metrics-total-traffic branch from 176c07f to fa214fe Compare August 22, 2024 19:22
@algorandskiy algorandskiy force-pushed the pavel/metrics-total-traffic branch from fa214fe to 26490b6 Compare August 22, 2024 21:22
@gmalouf gmalouf merged commit e14fea6 into algorand:master Aug 28, 2024
18 checks passed
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.

3 participants