Skip to content

Conversation

@emyller
Copy link
Contributor

@emyller emyller commented Jan 15, 2026

Reduce metrics loss under load by serving Prometheus metrics on a dedicated process and port, independent of the main API/task-processor server.

Changes

  • Add standalone Prometheus metrics HTTP server on port 9100
  • Start server via gunicorn when_ready hook when PROMETHEUS_ENABLED=true
  • Add integration tests validating equivalence with Django /metrics endpoint

This works in conjunction with:

Contributes to Flagsmith/pulumi#147

Review effort: 2/5

@emyller emyller force-pushed the fix/metrics-availability branch 2 times, most recently from e26be48 to a131c76 Compare January 15, 2026 22:56
@emyller emyller changed the title feat(Gunicorn): Serve /metrics on a dedicated port infra(Monitoring): Serve /metrics on a dedicated port Jan 15, 2026
@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.90%. Comparing base (6cb67b6) to head (85ef049).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #158      +/-   ##
==========================================
+ Coverage   95.76%   95.90%   +0.14%     
==========================================
  Files          86       90       +4     
  Lines        2949     3051     +102     
==========================================
+ Hits         2824     2926     +102     
  Misses        125      125              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@emyller emyller changed the title infra(Monitoring): Serve /metrics on a dedicated port feat(Gunicorn): Serve /metrics on a dedicated port Jan 15, 2026
@emyller emyller changed the title feat(Gunicorn): Serve /metrics on a dedicated port feat(Monitoring): Serve /metrics on a dedicated port Jan 15, 2026
@emyller emyller changed the title feat(Monitoring): Serve /metrics on a dedicated port fix(Monitoring): Serve /metrics on a dedicated port Jan 15, 2026
@emyller emyller force-pushed the fix/metrics-availability branch from a131c76 to c530702 Compare January 15, 2026 23:04
@emyller emyller force-pushed the fix/metrics-availability branch from c530702 to 5b99032 Compare January 16, 2026 23:20
@emyller emyller marked this pull request as ready for review January 20, 2026 14:12
@emyller emyller requested a review from a team as a code owner January 20, 2026 14:12
@emyller emyller requested review from Zaimwa9 and removed request for a team January 20, 2026 14:12
@emyller emyller force-pushed the fix/metrics-availability branch from 3b9da61 to 13aba21 Compare January 20, 2026 14:36
Copy link
Member

@khvn26 khvn26 left a comment

Choose a reason for hiding this comment

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

Happy to approve once the coverage is sorted.

@emyller emyller requested a review from khvn26 January 20, 2026 17:36
khvn26
khvn26 previously approved these changes Jan 20, 2026
khvn26
khvn26 previously approved these changes Jan 20, 2026
Co-authored-by: Kim Gustyr <kim.gustyr@flagsmith.com>
@khvn26 khvn26 merged commit 4da371e into main Jan 20, 2026
2 checks passed
@emyller emyller deleted the fix/metrics-availability branch January 20, 2026 18:18
@emyller emyller restored the fix/metrics-availability branch January 20, 2026 18:24
@emyller emyller deleted the fix/metrics-availability branch January 20, 2026 18:28
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.

4 participants