Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

fix: allow multiple consumers of metrics #6

Merged
merged 2 commits into from
Nov 21, 2022

Conversation

achingbrain
Copy link
Member

To support using labels as disambiguators across multiple reporters of the same metric, cache metrics globally then return the pre-exsting metric when it's registered on subsequent occasions.

To support using labels as disambiguators across multiple reporters
of the same metric, cache metrics globally then return the pre-exsting
metric when it's registered on subsequent occasions.
@achingbrain
Copy link
Member Author

achingbrain added a commit to libp2p/js-libp2p-tcp that referenced this pull request Nov 20, 2022
Instead of inserting the interface address into the metric name,
use the metric address as a label prefix for the value being reported.

This allows our metric names to be stable even if you don't
know the ip/port combo that will be used ahead of time.

The tradeoff is the label names may change between restarts if
the port number changes, but we have to apply a disambguator somewhere.

Depends on:

- [ ] libp2p/js-libp2p-prometheus-metrics#6
achingbrain added a commit to libp2p/js-libp2p-tcp that referenced this pull request Nov 20, 2022
Instead of inserting the interface address into the metric name,
use the metric address as a label prefix for the value being reported.

This allows our metric names to be stable even if you don't
know the ip/port combo that will be used ahead of time.

The tradeoff is the label names may change between restarts if
the port number changes, but we have to apply a disambguator somewhere.

Depends on:

- [ ] libp2p/js-libp2p-prometheus-metrics#6
@mpetrunic mpetrunic merged commit 92bde9b into main Nov 21, 2022
@mpetrunic mpetrunic deleted the fix/allow-multiple-consumers-of-metrics branch November 21, 2022 15:24
github-actions bot pushed a commit that referenced this pull request Nov 21, 2022
## [1.1.1](v1.1.0...v1.1.1) (2022-11-21)

### Bug Fixes

* allow multiple consumers of metrics ([#6](#6)) ([92bde9b](92bde9b))
@github-actions
Copy link

🎉 This PR is included in version 1.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

mpetrunic pushed a commit to libp2p/js-libp2p-tcp that referenced this pull request Nov 22, 2022
Instead of inserting the interface address into the metric name,
use the metric address as a label prefix for the value being reported.

This allows our metric names to be stable even if you don't
know the ip/port combo that will be used ahead of time.

The tradeoff is the label names may change between restarts if
the port number changes, but we have to apply a disambguator somewhere.

Depends on:

- [ ] libp2p/js-libp2p-prometheus-metrics#6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants