Skip to content

Expose ASB Postgres pool metrics#36

Merged
haasonsaas merged 1 commit intomainfrom
jh/asb-db-metrics
Apr 14, 2026
Merged

Expose ASB Postgres pool metrics#36
haasonsaas merged 1 commit intomainfrom
jh/asb-db-metrics

Conversation

@haasonsaas
Copy link
Copy Markdown
Collaborator

Summary

  • expose Postgres pool gauges on ASB's /metrics endpoint through service-runtime/observability.RegisterDBStats
  • carry runtime DB stats out of bootstrap so the API process can register dependency metrics without reaching into store internals
  • document and test the new database metrics output

Testing

  • go test ./cmd/asb-api ./internal/bootstrap ./internal/api/httpapi
  • go test ./...
  • git diff --check

Progresses #5

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 14, 2026

PR Summary

Low Risk
Low risk observability change that adds Prometheus gauges and threads DB pool stats through bootstrap; main risk is metric registration conflicts or nil wiring when Postgres is disabled.

Overview
Adds Postgres connection-pool gauges to ASB’s /metrics endpoint when ASB_POSTGRES_DSN is configured, via service-runtime/observability.RegisterDBStats.

internal/bootstrap.ServiceRuntime now carries a DBStats function (sourced from pgxpool.Stat() in newRepository), and cmd/asb-api registers these runtime metrics at startup; tests and README are updated to validate/document the new metric output.

Reviewed by Cursor Bugbot for commit 472bac0. Bugbot is set up for automated code reviews on this repo. Configure here.

@haasonsaas haasonsaas merged commit 7a9bb23 into main Apr 14, 2026
4 checks passed
@haasonsaas haasonsaas deleted the jh/asb-db-metrics branch April 14, 2026 01:10
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.

1 participant