Skip to content

expose hedge stats via Prometheus-style /metrics handler#16

Open
batazor wants to merge 1 commit intobhope:mainfrom
batazor:prometheus-metrics
Open

expose hedge stats via Prometheus-style /metrics handler#16
batazor wants to merge 1 commit intobhope:mainfrom
batazor:prometheus-metrics

Conversation

@batazor
Copy link
Copy Markdown

@batazor batazor commented Apr 23, 2026

Close #2

Copilot AI review requested due to automatic review settings April 23, 2026 02:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Prometheus-compatible metrics exposition path for hedge.Stats, enabling consumers to scrape hedge transport counters via an HTTP /metrics endpoint.

Changes:

  • Extend Stats with WritePrometheus(io.Writer) and ServeHTTP(http.ResponseWriter, *http.Request) for Prometheus text exposition.
  • Make Snapshot() / HedgeRate() nil-safe.
  • Add HTTP handler tests and document /metrics usage in the README.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
stats.go Implements Prometheus text exposition output and an HTTP handler on Stats.
hedge_test.go Adds tests covering /metrics GET and method-not-allowed behavior.
README.md Documents how to mount stats as a Prometheus-style /metrics endpoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread stats.go Outdated
Comment thread stats.go
Comment thread README.md
@batazor batazor force-pushed the prometheus-metrics branch from 09fb1b7 to 999db6a Compare April 23, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prometheus metrics export

2 participants