Skip to content

SS-1322 monitor connection pool#546

Merged
hamzaimran08 merged 7 commits into
developfrom
SS-1322-monitor-connection-pool
Jun 18, 2026
Merged

SS-1322 monitor connection pool#546
hamzaimran08 merged 7 commits into
developfrom
SS-1322-monitor-connection-pool

Conversation

@hamzaimran08

@hamzaimran08 hamzaimran08 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR relates to SS-1322 and SS-1929.

Adds connection pool observability for Serve so we can inspect Django-side PostgreSQL pool during outages without exec-ing into pods and also request behavior.

  • Adds a /metrics endpoint gated by PROMETHEUS_METRICS_ENABLED; when disabled, the endpoint returns 404.
  • Exposes Django/psycopg pool values as Prometheus gauges, labelled by database alias, pod name, process id, and pool id.
  • Tracks pool enabled/opened state, configured min/max size, current size, available connections, waiting requests, served requests, and pool request errors.
  • Adds Django HTTP request metrics:
    • django_http_requests_total
    • django_http_request_duration_seconds
    • django_http_request_exceptions_total
  • Records HTTP metrics with labels: method, resolved route, status code, exception type, and pod.
  • Adds optional DB pool stats logging through DB_POOL_STATS_LOGGING_ENABLED, logging only when relevant pool values change.
  • Includes matching serve-charts configuration so Helm can enable the metrics endpoint and Prometheus scraping while keeping /metrics blocked from public ingress.

Checklist

  • This pull request is against develop branch (not applicable for hotfixes)
  • I have included a link to the issue on GitHub or JIRA (if any)
  • I have included migration files (if there are changes to the model classes)
  • I have added or updated unit and end2end tests or a manual test case to complement my changes
  • I have ran unit and end2end tests
  • I have updated the related documentation (if necessary)
  • I have added a reviewer for this pull request
  • I have added myself as an author for this pull request
  • In the case I have modified settings.py, then I have also updated the studio-settings-configmap.yaml file in serve-charts
  • In case your changes are large enough, did you deploy your changes to develop instance?

@hamzaimran08 hamzaimran08 requested a review from a team as a code owner June 10, 2026 07:47
@hamzaimran08 hamzaimran08 self-assigned this Jun 10, 2026
@hamzaimran08 hamzaimran08 requested a review from j-awada June 10, 2026 08:47
Comment thread studio/metrics.py
@hamzaimran08 hamzaimran08 merged commit 6da0da0 into develop Jun 18, 2026
2 checks passed
@hamzaimran08 hamzaimran08 deleted the SS-1322-monitor-connection-pool branch June 18, 2026 12:34
j-awada pushed a commit that referenced this pull request Jun 22, 2026
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.

2 participants