Embrace `prometheus` as a first-class dependency
Open
Nobody has claimed this yet.
decision-pending
difficulty:moderate
priority:nicetohave
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Description
Currently, we collect metrics by inspecting events that are returned from the Swarm and other protocols. Instead of doing that, let's add prometheus as an optional dependency to our components.
Motivation
- Provide richer metrics by having access to several internals. For example, we could easily report certain buffer sizes as metrics.
libp2p-swarmis very much a runtime kind of component. Rich instrumentation will be beneficial for users. - Smaller API surface. Currently, we expose certain information (like time to establish a connection) in events only to then capture it in another module again and make it a metric.
- Easier way of getting started. Users only need to activate a feature and will get metrics. No more passing events around.
Downsides
- A lock-in on one metric collection system and dependency.
Current Implementation
Are you planning to do it yourself in a pull request?
Maybe.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the current event-based metrics flow in the Swarm and other protocols, with particular attention to the libp2p-swarm component. Determine the optional dependency and feature boundaries, then define what instrumentation and metric coverage would be needed before considering the migration complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- prometheus, rust
- Domain
- networking, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100