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

fix: use labels to differentiate interfaces for metrics #230

Merged
merged 1 commit into from
Nov 22, 2022

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented 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:

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
Copy link
Member

@achingbrain Should we wait for the libp2p release with updated prometheus metrics before merging this?

@achingbrain
Copy link
Member Author

No need - this module uses the new metrics interface as of v6

@mpetrunic
Copy link
Member

No need - this module uses the new metrics interface as of v6

I get that, but will it cause perf issues before we update prometheus metrics in libp2p?

@achingbrain
Copy link
Member Author

Are you talking about using it with the current libp2p release? If so tsc should complain as libp2p@0.40.x supplies @libp2p/interface-metrics@3.x.x and this module requires @libp2p/interface-metrics@4.x.x - it should be used with libp2p@next

@mpetrunic
Copy link
Member

Are you talking about using it with the current libp2p release? If so tsc should complain as libp2p@0.40.x supplies @libp2p/interface-metrics@3.x.x and this module requires @libp2p/interface-metrics@4.x.x - it should be used with libp2p@next

Ah I see!

@mpetrunic mpetrunic merged commit 6c4c316 into master Nov 22, 2022
@mpetrunic mpetrunic deleted the fix/use-labels-for-metric-events branch November 22, 2022 14:13
github-actions bot pushed a commit that referenced this pull request Nov 22, 2022
## [6.0.4](v6.0.3...v6.0.4) (2022-11-22)

### Bug Fixes

* use labels to differentiate interfaces for metrics ([#230](#230)) ([6c4c316](6c4c316))
@github-actions
Copy link

🎉 This PR is included in version 6.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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