Register an arbitrary counter. Call this to set help/labels for counters and increment them by calling methods on the returned counter object
Optional
options: MetricOptionsRegister a a group of related counters. Call this to set help/labels for
groups of related counters that will be updated with by calling the .increment
method on the returned counter group object
Optional
options: MetricOptionsRegister an arbitrary histogram. Call this to set help/labels for histograms and observe them by calling methods on the returned histogram object
Optional
options: HistogramOptionsRegister a a group of related histograms. Call this to set help/labels for
groups of related histograms that will be updated with by calling the .observe
method on the returned histogram group object
Optional
options: HistogramOptionsRegister an arbitrary metric. Call this to set help/labels for metrics and update/increment/decrement/etc them by calling methods on the returned metric object
Optional
options: MetricOptionsRegister a a group of related metrics. Call this to set help/labels for
groups of related metrics that will be updated with by calling .update
,
.increment
and/or .decrement
methods on the returned metric group object
Optional
options: MetricOptionsRegister an arbitrary summary. Call this to set help/labels for summaries and observe them by calling methods on the returned summary object
Optional
options: SummaryOptionsRegister a a group of related summaries. Call this to set help/labels for
groups of related summaries that will be updated with by calling the .observe
method on the returned summary group object
Optional
options: SummaryOptionsTrack a newly opened multiaddr connection
Track a newly opened protocol stream
The libp2p metrics tracking object. This interface is only concerned with the collection of metrics, please see the individual implementations for how to extract metrics for viewing.
Example: How to register a simple metric
Example: How to register a dynamically calculated metric
A metric that is expensive to calculate can be created by passing a
calculate
function that will only be invoked when metrics are being scraped:Example: How to register a group of metrics
If several metrics should be grouped together (e.g. for graphing purposes)
registerMetricGroup
can be used instead:There are specific metric groups for tracking libp2p connections and streams:
Example: How to track multiaddr connections
This is something only libp2p transports need to do.
Example: How to track protocol streams
This is something only libp2p connections need to do.