js-libp2p
js-libp2p copied to clipboard
feat: add devtools metrics
Adds a metrics implementation that is scrapable by a browser DevTools plugin.
Change checklist
- [x] I have performed a self-review of my own code
- [x] I have made corresponding changes to the documentation if necessary (this includes comments as well)
- [x] I have added tests that prove my fix is effective or that my feature works
Sweet!
When trying this out using the following libp2p config, I get the following error:
TypeError: Cannot read properties of undefined (reading 'update')
at TrackedMap.updateComponentMetric (tracked-map.ts:38:17)
at new TrackedMap (tracked-map.ts:17:10)
at trackedMap (tracked-map.ts:59:11)
at new DefaultTransportManager (transport-manager.ts:33:22)
at new Libp2pNode (libp2p.ts:118:49)
at createLibp2pNode (libp2p.ts:418:10)
at async createLibp2p (index.ts:167:16)
at async App (index.js:50:18)
Do you know what might be the reason?
Do you know what might be the reason?
I think you may be using the placeholder version published to npm. You'll need to replace the src and dist folders in /node_modules/libp2p/devtools-metrics with versions built from this PR branch for it to work.