René's URL Explorer Experiment


Title: feat(webapp): per-client database pool metrics that survive the driver adapter by ericallam · Pull Request #4541 · triggerdotdev/trigger.dev · GitHub

Open Graph Title: feat(webapp): per-client database pool metrics that survive the driver adapter by ericallam · Pull Request #4541 · triggerdotdev/trigger.dev

X Title: feat(webapp): per-client database pool metrics that survive the driver adapter by ericallam · Pull Request #4541 · triggerdotdev/trigger.dev

Description: What Follow-up to #4539. The driver-adapter work is inert until a client flips to the pg driver adapter, but the moment one does, our database observability degrades: the OTel metrics pipeline reads pool stats from Prisma's $metrics, which is owned by the Rust engine's quaint pool. Under the adapter, pg.Pool owns the pool, so those gauges read zero. The pipeline also only ever scraped a single client (the control-plane writer singleton). This PR makes database metrics driver-agnostic and per-client: Every configured client registers a metrics source: control-plane writer/replica, run-ops writer/replica, legacy writer/replica. Previously only the control-plane writer singleton was scraped. Each OTel instrument is observed per client with db_client and db_driver (quaint | pg-adapter) attributes. db_client uses our canonical datasource-role labels (control-plane-writer, control-plane-replica, run-ops-writer, run-ops-replica, legacy-run-ops-writer, legacy-run-ops-replica) — the same strings used for the db.datasource span attribute, so a metric and a trace point at the same pool. Pool figures come from the authoritative source per driver: pg-adapter: pg.Pool (totalCount/idleCount/waitingCount, plus cumulative opened/closed from connect/remove events). quaint: the Rust engine's $metrics pool gauges/counters, exactly as before. Query counters and duration histograms still come from $metrics for both drivers (the Rust engine executes queries in both cases). New db.pool.connections.waiting gauge (pg.Pool exposes this; quaint reports 0). Stops exporting Prisma metrics from the Prometheus /metrics route. Pool observability now lives entirely in the OTel pipeline, per driver, per client. Why So we can flip any client (including the control-plane writer, the primary desync-fix target) to the driver adapter without losing pool visibility. Existing dashboards keyed on the same metric names keep working; they gain a per-client dimension. Testing Unit (apps/webapp/app/utils/databaseMetrics.server.test.ts): the pure normalizer — quaint reads pool from $metrics; adapter reads pool from pg.Pool and keeps engine query metrics; busy never goes negative; graceful zeroing when $metrics is unavailable (adapter still reports live pool figures). Live smoke test against a prod-shaped local stack: three physically-distinct Postgres DBs (control-plane, run-ops, legacy) behind dual PgBouncers, split mode on, with a mix of adapter and quaint clients. Reading the actual emitted OTel metrics, every pool shows up as its own series: db.pool.connections.total{db_client="control-plane-writer", db_driver="pg-adapter"} = 1 db.pool.connections.total{db_client="control-plane-replica", db_driver="quaint"} = 1 db.pool.connections.total{db_client="run-ops-writer", db_driver="pg-adapter"} = 1 db.pool.connections.total{db_client="run-ops-replica", db_driver="quaint"} = 1 db.pool.connections.total{db_client="legacy-run-ops-writer", db_driver="quaint"} = 1 db.pool.connections.total{db_client="legacy-run-ops-replica",db_driver="quaint"} = 1 db.client.queries.total{db_client="control-plane-writer",db_driver="pg-adapter"} = incrementing db.client.queries.duration.count{db_client="control-plane-writer",db_driver="pg-adapter"} = incrementing Confirms: metrics are attributed per pool with the correct driver; adapter pools' figures come from pg.Pool; and query counters/duration histograms keep incrementing under the pg adapter. Also verified /metrics (Prometheus) now returns zero prisma_* series while still serving the app's own metrics. pnpm run typecheck --filter webapp passes. Notes /metrics (Prometheus) no longer includes prisma_* series. Anything scraping that endpoint for Prisma metrics should read the equivalent db.* metrics from the OTel exporter instead. PgBouncer + ?schema= gotcha (separate from this PR, worth flagging for rollout): since #4539 parses ?schema= from the DSN and passes { schema } to the adapter, node-postgres sends search_path as a startup parameter. A transaction-mode PgBouncer rejects that with FATAL: unsupported startup parameter: search_path. Our prod control-plane DSNs use the default public schema with no ?schema= param, so this is latent, but any client we flip to the adapter must not carry ?schema= in its DSN (or the pooler needs ignore_startup_parameters = search_path).

Open Graph Description: What Follow-up to #4539. The driver-adapter work is inert until a client flips to the pg driver adapter, but the moment one does, our database observability degrades: the OTel metrics pipeline read...

X Description: What Follow-up to #4539. The driver-adapter work is inert until a client flips to the pg driver adapter, but the moment one does, our database observability degrades: the OTel metrics pipeline read...

Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/4541

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:d92a0b28-7497-4049-9ae2-9a56d90b1bcf
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE460:171254:6C7CB5:A0D8BE:6AFAF3C7
html-safe-nonce3876214a4abb31ec920fed5da771560ba2e9d66b47047723e597d985f289fd29
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDYwOjE3MTI1NDo2QzdDQjU6QTBEOEJFOjZBRkFGM0M3IiwidmlzaXRvcl9pZCI6IjMxNTIzNDI3MTg1NTU3MTkxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9fd61abc230d5df410b0657bd0252337336fa268a9948686d411663094e7ea17
hovercard-subject-tagpull_request:4236215872
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/4541/files
twitter:imagehttps://avatars.githubusercontent.com/u/534?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/534?s=400&v=4
og:image:altWhat Follow-up to #4539. The driver-adapter work is inert until a client flips to the pg driver adapter, but the moment one does, our database observability degrades: the OTel metrics pipeline read...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0178036d8230524a18422872393ab7e708443ae4c2047f758560a2db870c1913
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git
octolytics-dimension-user_id95297378
octolytics-dimension-user_logintriggerdotdev
octolytics-dimension-repository_id572570113
octolytics-dimension-repository_nwotriggerdotdev/trigger.dev
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id572570113
octolytics-dimension-repository_network_root_nwotriggerdotdev/trigger.dev
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea85e96a83bed7871993e6b1ffda24105928eee17
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/triggerdotdev/trigger.dev/pull/4541/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F4541%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F4541%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=triggerdotdev%2Ftrigger.dev
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
triggerdotdevhttps://github.com/triggerdotdev
trigger.devhttps://github.com/triggerdotdev/trigger.dev
Codehttps://github.com/triggerdotdev/trigger.dev
Issues203 (203)https://github.com/triggerdotdev/trigger.dev/issues
Pull requests67 (67)https://github.com/triggerdotdev/trigger.dev/pulls
Discussionshttps://github.com/triggerdotdev/trigger.dev/discussions
Actionshttps://github.com/triggerdotdev/trigger.dev/actions
Projectshttps://github.com/triggerdotdev/trigger.dev/projects
Security and quality39 (39)https://github.com/triggerdotdev/trigger.dev/security
Insightshttps://github.com/triggerdotdev/trigger.dev/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
ericallamhttps://github.com/ericallam
mainhttps://github.com/triggerdotdev/trigger.dev/tree/main
feat/db-pool-metrics-per-clienthttps://github.com/triggerdotdev/trigger.dev/tree/feat/db-pool-metrics-per-client
Conversation 20 https://github.com/triggerdotdev/trigger.dev/pull/4541
Commits 5 https://github.com/triggerdotdev/trigger.dev/pull/4541/commits
Checks 62 https://github.com/triggerdotdev/trigger.dev/pull/4541/checks
Files changed https://github.com/triggerdotdev/trigger.dev/pull/4541/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
feat(webapp): per-client database pool metrics that survive the driver adapter https://github.com/triggerdotdev/trigger.dev/pull/4541/files#top
Show all changes 5 commits https://github.com/triggerdotdev/trigger.dev/pull/4541/files
c71c46b feat(webapp): per-client database pool metrics that survive the drive… ericallam Aug 8, 2026 https://github.com/triggerdotdev/trigger.dev/pull/4541/commits/c71c46beed370906658917ae50722b21a4411d05
5d964b2 feat(webapp): use canonical datasource labels for db_client metric at… ericallam Aug 8, 2026 https://github.com/triggerdotdev/trigger.dev/pull/4541/commits/5d964b21a68886b8ae644043724ec115b0e09d26
0a93dc0 fix(webapp): address review on db pool metrics registry ericallam Aug 9, 2026 https://github.com/triggerdotdev/trigger.dev/pull/4541/commits/0a93dc087d71b35e0ed053edeb0b8ccfa647ce3f
2ec585b fix(webapp): oxfmt the metrics module and simplify the server-changes… ericallam Aug 9, 2026 https://github.com/triggerdotdev/trigger.dev/pull/4541/commits/2ec585b41bb8b2cf22aff6bb208946cabe71f662
a9b9ccd fix(webapp): don't emit zeroed engine metrics when $metrics read fails ericallam Aug 10, 2026 https://github.com/triggerdotdev/trigger.dev/pull/4541/commits/a9b9ccd3d58f119e440d62fcd84d0fb770d4bbbb
Clear filters https://github.com/triggerdotdev/trigger.dev/pull/4541/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
db-pool-metrics-per-client.md https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-40543507e7b320e96355f113e4b8bbff1f69f948dc21cdeb87138155b689c787
db.server.ts https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
metrics.ts https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-e24cf5a28474e71ebac052f3843d306ca4c64375f521c53f12ce1cf860c25760
databaseMetrics.server.test.ts https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-0b564d6f819298d3309a45ceb567493b79b9d31e336c961ae736cb45b899f282
databaseMetrics.server.ts https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f5fec1f8c625c2e11c4fbd7f075f454ace50edaecb05445030668a24b20d6412
tracer.server.ts https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-746e75ef48528afe08bbadc078c7c25e75fdc178a0f706b614860816c4ea5eaf
.server-changes/db-pool-metrics-per-client.mdhttps://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-40543507e7b320e96355f113e4b8bbff1f69f948dc21cdeb87138155b689c787
View file https://github.com/triggerdotdev/trigger.dev/blob/a9b9ccd3d58f119e440d62fcd84d0fb770d4bbbb/.server-changes/db-pool-metrics-per-client.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/4541/{{ revealButtonHref }}
apps/webapp/app/db.server.tshttps://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
View file https://github.com/triggerdotdev/trigger.dev/blob/a9b9ccd3d58f119e440d62fcd84d0fb770d4bbbb/apps/webapp/app/db.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/4541/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-f81e28167ca153a26ec3513924ea843f71b59992d6fddf7f66ebe131bd5b0d89
apps/webapp/app/routes/metrics.tshttps://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-e24cf5a28474e71ebac052f3843d306ca4c64375f521c53f12ce1cf860c25760
View file https://github.com/triggerdotdev/trigger.dev/blob/a9b9ccd3d58f119e440d62fcd84d0fb770d4bbbb/apps/webapp/app/routes/metrics.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/4541/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-e24cf5a28474e71ebac052f3843d306ca4c64375f521c53f12ce1cf860c25760
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
https://github.com/triggerdotdev/trigger.dev/pull/4541/files#diff-e24cf5a28474e71ebac052f3843d306ca4c64375f521c53f12ce1cf860c25760
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4541/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.