Takes the metadata for a message and tracks it in the appropriate categories. If the protocol is present, protocol stats will also be tracked.
Gets the global Stats
object
Returns a list of PeerId
strings currently being tracked
Returns a list of all protocol strings currently being tracked.
Returns the Stats
object for the given protocol
.
Should be called when all connections to a given peer
have closed. The Stats
collection for the peer will
be stopped and moved to an LRU for temporary retention.
Must be called for stats to saved. Any data pushed for tracking will be ignored.
Stops all averages timers and prevents new data from being tracked.
Once stop
is called, start
must be called to resume stats tracking.
Tracks data running through a given Duplex Iterable stream
. If
the peerId
is not provided, a placeholder string will be created and
returned. This allows lazy tracking of a peer when the peer is not yet known.
When the PeerId
is known, Metrics.updatePlaceholder
should be called
with the placeholder string returned from here, and the known PeerId
.
The peerId string or placeholder string
{import('../connection-manager')} connectionManager
{number} [computeThrottleMaxQueueSize = defaultOptions.computeThrottleMaxQueueSize]
{number} [computeThrottleTimeout = defaultOptions.computeThrottleTimeout]
{number[]} [movingAverageIntervals = defaultOptions.movingAverageIntervals]
{number} [maxOldPeersRetention = defaultOptions.maxOldPeersRetention]