I am working on a web application (Vite/Typescript) where we are creating libp2p peers from the application itself.
I would like to capture some metrics but I am not able to find a way to doing that. I did find the interface definition and the node/prometheus implementation, but nothing that could run in a browser.
Is there such support, and, if yes, is there some documentation/examples describing how to do it?
@pshahi I am looking at capturing and sending the libp2p metrics to an OTLP backend. I read some more and I did find the metrics interface which looks to be based on Prometheus metrics. I also found this library which implements everything (GitHub - libp2p/js-libp2p-prometheus-metrics: Collect libp2p metrics for scraping by Prometheus) but which is based on node - in addition to captuing the libp2p metrics, it also attempts to capture node provided metrics (like memory usage) which would not work in a browser.
I’m currently trying to develop my own OTLP based implementation of the libp2p expected interfaces which would allow me to send the data to an OTLP metrics aggregator.
In an ideal world, I would have liked if the lib2p2 lib would expose the metrics as OTLP (which is an open standard) and not Prometheus. As an alternative, it would also be nice if the lib would allow selecting between Prometheus and OTLP.
thanks for taking a look into our current libp2p metrics implementation but you are right in that it is tailored to node environments. That being said other consumers have raised this in the past and utilized GitHub - weaveworks/promjs for their client.