-
-
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?
Changes from all commits
c71c46b
5d964b2
0a93dc0
2ec585b
File filter
Filter by extension
Conversations
Jump to
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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 Removing prisma metrics from /metrics also removes the only Prometheus-side pool visibility The Prometheus route no longer emits any Was this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| return new Response(metrics, { | ||
| headers: { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.