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

Add prometheus metrics for DHT internals #3500

Merged
merged 22 commits into from Jan 14, 2022
Merged

Add prometheus metrics for DHT internals #3500

merged 22 commits into from Jan 14, 2022

Conversation

shyba
Copy link
Member

@shyba shyba commented Dec 3, 2021

The SDK already supports exporting metrics over Prometheus if the user wishes to do so. This PR adds the following metrics under the dht_node namespace:

data store

protocol

  • peer_manager_keys: Number of keys tracked by PeerManager dicts (sum)
    • If that grows too large, we can get memory leaks
  • request_sent: Number of requests send from DHT RPC protocol
  • request_success: Number of successful requests
  • request_error: Number of errors returned from request to other peers
  • response_time: Response times of DHT RPC requests
  • received_request: Number of received DHT RPC requests

routing table

  • peers_in_routing_table: Number of peers on routing table
  • peer_x_bit_colliding: Number of peers with at least X bits colliding with this node id
  • buckets_in_routing_table: Number of buckets on routing table
    • Debugging purposes.

New endpoints:

When starting the seed node script with --metrics_port=<some_port>, a web server will expose the following endpoints:

  • /metrics: Prometheus endpoint with the above metrics.

If desired, routing table peers and announced blobs can be exported in CSV format using --enable_csv_export. However, you should use a firewall and avoid exposing that publicly as the announced blobs list can reach multiple thousands items, easily bringing your server down by malicious users.

  • /peers.csv: All peers from the routing table in CSV format (ip, port, node_id)
  • /blobs.csv: All blobs announced to the node in CSV format (hex encoded blob hash)

@shyba shyba force-pushed the fix_script branch 2 times, most recently from af6c669 to abaa20f Compare December 6, 2021 20:50
@coveralls
Copy link

coveralls commented Dec 6, 2021

Coverage Status

Coverage remained the same at 69.714% when pulling f689a97 on fix_script into e6efc1a on master.

@shyba shyba force-pushed the fix_script branch 2 times, most recently from 748d748 to 41e1368 Compare December 14, 2021 21:18
@shyba shyba force-pushed the fix_script branch 3 times, most recently from d26bc1e to 503177b Compare December 23, 2021 21:30
@shyba shyba changed the title Update dht script for network size estimation endpoints Add Prometheus metrics for DHT internals Dec 24, 2021
@shyba shyba force-pushed the fix_script branch 2 times, most recently from baa965b to f689a97 Compare January 7, 2022 16:31
@lyoshenka
Copy link
Member

  • drop *_flight counter
  • rebase
  • ready to merge

@jackrobison jackrobison merged commit f78e382 into master Jan 14, 2022
@jackrobison jackrobison deleted the fix_script branch January 14, 2022 17:46
@jackrobison jackrobison added type: new feature New functionality that does not exist yet area: DHT type: improvement Existing (or partially existing) functionality needs to be changed and removed type: new feature New functionality that does not exist yet labels Mar 4, 2022
@jackrobison jackrobison changed the title Add Prometheus metrics for DHT internals Add prometheus metrics for DHT internals Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DHT type: improvement Existing (or partially existing) functionality needs to be changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants