Skip to content

obs: Add Prometheus metrics endpoint for request counting and latency#161

Merged
YaronZaki merged 5 commits into
Quantarq:mainfrom
amberly-d:feat/prometheus-metrics-82
Jun 23, 2026
Merged

obs: Add Prometheus metrics endpoint for request counting and latency#161
YaronZaki merged 5 commits into
Quantarq:mainfrom
amberly-d:feat/prometheus-metrics-82

Conversation

@amberly-d

Copy link
Copy Markdown
Contributor

Description

Add Prometheus metrics instrumentation to the FastAPI backend: a middleware that tracks request count, latency histograms, and in-flight gauge, plus a /metrics endpoint exposing data in Prometheus text format.

Related Issue

Closes #82

Change Type

  • feat — new feature

Testing Done

153 unit tests pass. All failures are pre-existing DB connectivity issues unrelated to these changes.

Checklist

  • Tests pass (pytest)
  • Code passes linting (pylint)
  • PR is linked to a related issue

- Add prometheus-client==0.21.1 dependency
- Add PrometheusMiddleware tracking http_requests_total, http_request_duration_seconds, http_requests_in_flight
- Expose /metrics endpoint

Closes Quantarq#82

Copy link
Copy Markdown
Contributor

Hi @amberly-d — the implementation looks great; the middleware, /metrics endpoint, and histogram labels are well thought out. CI is failing at the install step though, because pyproject.toml (now adding prometheus-client) drifted from poetry.lock. The error is:

pyproject.toml changed significantly since poetry.lock was last generated. Run poetry lock to fix the lock file.

Quick fix: run poetry lock locally and push the updated poetry.lock. Once that lands, this is good to merge. ✅

@YaronZaki

Copy link
Copy Markdown
Contributor

@amberly-d resolve conflicts

@YaronZaki YaronZaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@YaronZaki YaronZaki merged commit 4e00eeb into Quantarq:main Jun 23, 2026
3 checks passed
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.

obs: Add Prometheus metrics endpoint for request counting and latency

2 participants