Module @libp2p/simple-metrics

Stores metrics in memory and periodically invokes a configured callback to receive them.

Example

import { createLibp2p } from 'libp2p'
import { simpleMetrics } from '@libp2p/simple-metrics'

const node = await createLibp2p({
// ... other options
metrics: simpleMetrics({
onMetrics: (metrics) => {
// do something with metrics
}
}),
intervalMs: 1000 // default 1s
})

@libp2p/simple-metrics

libp2p.io Discuss codecov CI

Simple in-memory metrics gathering for libp2p

About

Stores metrics in memory and periodically invokes a configured callback to receive them.

Example

import { createLibp2p } from 'libp2p'
import { simpleMetrics } from '@libp2p/simple-metrics'

const node = await createLibp2p({
// ... other options
metrics: simpleMetrics({
onMetrics: (metrics) => {
// do something with metrics
}
}),
intervalMs: 1000 // default 1s
})

Install

$ npm i @libp2p/simple-metrics

Browser <script> tag

Loading this module through a script tag will make its exports available as Libp2pSimpleMetrics in the global namespace.

<script src="https://unpkg.com/@libp2p/simple-metrics/dist/index.min.js"></script>

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Index

Interfaces

Functions