• Creates a PeerList that reports it's size to the libp2p Metrics service

    Parameters

    Returns PeerList

    Example

    • 
      

    import { trackedPeerList } from '@libp2p/peer-collections' import { createLibp2p } from 'libp2p'

    const libp2p = await createLibp2p()

    const list = trackedPeerList({ name: 'my_metric_name', metrics: libp2p.metrics }) list.push(peerId) ```