Add more metrics to the DHT crawler#436
Conversation
| scrapePeerCount prometheus.Histogram | ||
| scrapeNodeCount prometheus.Histogram | ||
| scrapeNodeTotal *prometheus.CounterVec | ||
| logger *zap.SugaredLogger |
There was a problem hiding this comment.
That's a LOT of properties to add here; I think much of this is already being collected here/elsewhere? https://github.com/bitmagnet-io/bitmagnet/blob/main/internal/protocol/dht/server/prometheus_collector.go
There was a problem hiding this comment.
All the metrics I've added here are separate from the existing collectors. They serve two purposes not covered by the sucess/latency metrics already existing.
- The histograms gather statistics about the responses received from the DHT per query type (something that isn't recorded by current metrics as the recorded metric depends on the query type). This isn't immediately useful to us, it's more interesting from a general DHT analysis perspective.
- The counters gather statistics about the flow of data through the DHT crawler itself.
There was a problem hiding this comment.
I am aware it's a lot of metrics to add; my opinion with metrics is that it's better to err on the side of too many rather than not enough seeing as they are so cheap to add. If there's any metrics in particular you think aren't useful, we can get rid of them.
fd8eaa9 to
ac2831f
Compare
Add per-operation metrics for discovered nodes, find_node, get_peers, sample_infohashes, scrape, infohash triage, and metainfo requests. Also adds FilterKnownAddrs to ktable.Table interface for IPv6 dual-stack node filtering. Based on PR bitmagnet-io#436 by abitofevrything, adapted for our dual-stack codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Depends on #435 as the new filtering logic in
discovered_nodesaffects metric collection.