Skip to content

feat: non-global metrics usage, add metrics sets #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

Frando
Copy link
Member

@Frando Frando commented Apr 4, 2025

Description

  • Allow to create structs implementing Metric without registering them to the superglobal Core
  • Allow to optionally register these metrics to a prometheus_client::registry::Registry, and/or iterate over the individual metrics items manually
  • Add a trait MetricSet which can be implemented on structs containing multiple structs that each implement Metric. It allows to iterate over metric structs, and each contained metrics item, and provides a method register_all to register all contained metrics to a prometheus registry.

This demonstrates how we could expose a struct EndpointMetrics from the endpoint, which has multiple metric sets inside, and still provide a straightforward way to both register them on a prometheus_client::Registry, and use them manually without prometheus_client.

Based on #12

Breaking Changes

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

Copy link

github-actions bot commented Apr 4, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-metrics/pr/14/docs/iroh_gossip/

Last updated: 2025-04-08T09:23:35Z

@n0bot n0bot bot added this to iroh Apr 4, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Apr 4, 2025
@Frando Frando changed the title WIP demo: metric groups feat: non-global metrics usage, add metrics sets Apr 8, 2025
@Frando
Copy link
Member Author

Frando commented Apr 10, 2025

Closing in favor of #15

@Frando Frando closed this Apr 10, 2025
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants