go-algorand icon indicating copy to clipboard operation
go-algorand copied to clipboard

p2p: add telemetry and DHT/libp2p metrics

Open algorandskiy opened this issue 1 year ago • 2 comments

Summary

Add missing p2p telemetry similarly to wsNetwork:

  • [x] meshThread peers connection stats - generalize and reuse sendPeerConnectionsTelemetryStatus from wsNet
  • [x] ConnectedIn / ConnectedOut
  • [x] Disconnect

In order to propagate telemetryID and instanceName provided by logging module, p2p peers expose a fake /algorand-telemetry/1.0.0/{TID}/{INSTANCE} protocol so that remote side can discover it and treat as some extra meta information. This is a workaround for HTTP transport with its custom HTTP headers.

Add DHT stats collected with OpenCensus (so that a new dependency):

  1. Enabled DHT stats when metrics collection is enabled
  2. Converted to Metric-compatible type when gathered
  3. Added to heartbeat telementry event

Add libp2p prometheus metrics gathering. Supporting only counters and gauges (missing histograms, similarly to DHT).

Test Plan

Added unit tests for telemetryID/instanceName functionality. Added a unit test for stats similar to what DHT uses. Added a unit test for metrics similar to what libp2p uses.

algorandskiy avatar Feb 23 '24 18:02 algorandskiy