Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(webapp): per-client database pool metrics that survive the driver adapter#4541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c71c46b5d964b20a93dc02ec585ba9b9ccdFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: improvement | ||
| --- | ||
| Database connection metrics are now reported for every configured database connection instead of only the primary one, and stay accurate regardless of connection type. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| import type { LoaderFunctionArgs } from "@remix-run/server-runtime"; | ||
| import { prisma } from "~/db.server"; | ||
| import { metricsRegister } from "~/metrics.server"; | ||
| export async function loader({ request }: LoaderFunctionArgs) { | ||
| @@ -13,17 +12,7 @@ export async function loader({ request }: LoaderFunctionArgs) { | ||
| } | ||
| } | ||
| // We need to remove empty lines from the prisma metrics, grafana doesn't like them | ||
| let prismaMetrics = ""; | ||
| try { | ||
| prismaMetrics = (await prisma.$metrics.prometheus()).replace(/^\s*[\r\n]/gm, ""); | ||
| } catch { | ||
| prismaMetrics = ""; | ||
| } | ||
| const coreMetrics = await metricsRegister.metrics(); | ||
| // Order matters, core metrics end with `# EOF`, prisma metrics don't | ||
| const metrics = prismaMetrics + coreMetrics; | ||
| const metrics = await metricsRegister.metrics(); | ||
ericallam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. ericallam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| return new Response(metrics, { | ||
| headers: { | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.