Direct integration with prometheus instead of libp2p-metrics
#3868
Replies: 2 comments 1 reply
-
Note that we would want to make use of |
Beta Was this translation helpful? Give feedback.
-
Alternatively to prometheus, we could also integrate with OTEL. That is more capable than prometheus, i.e. it can also to spans etc and it can be converted into prometheus metrics. However, I actually think that once we have #1533, it would be quite easy to extract several metrics by just looking at the spans. For example, we can attach a span to the task for upgrading a connection which will give us the exact duration how long it took! Closing this for now. |
Beta Was this translation helpful? Give feedback.
-
Currently, gathering metrics from
libp2p
is done by integrating thelibp2p-metrics
crate which requires the user to do the wiring themselves, i.e. in the event-loop where the poll theSwarm
, they need to also pass each event to the metrics instance to record all sorts of data.Pros
prometheus-client
to libp2p crates other thanlibp2p-metrics
Cons
Swarm
internals like size of buffers or queuesIf we make
prometheus-client
lean enough (i.e. by default don't expose heavy macro dependencies, etc) we can just add it as a dependency unconditionally and thus avoidcfg
s throughout our code.Similarly, if we spend some cycles on future-proofing the API to avoid more breaking changes, having it in the public API of our crates is not too big of a deal.
Long term, I think it would make sense to integrate prometheus metrics directly into the
Swarm
and all other protocols. This would allow us to provide the user with detailed metrics out of the box without any additional wiring boilerplate.Opinions welcome.
Beta Was this translation helpful? Give feedback.
All reactions