We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4813a2 commit 6726bf8Copy full SHA for 6726bf8
apps/webapp/app/routes/metrics.ts
@@ -3,6 +3,16 @@ import { prisma } from "~/db.server";
3
import { metricsRegister } from "~/metrics.server";
4
5
export async function loader({ request }: LoaderFunctionArgs) {
6
+ // If the TRIGGER_METRICS_AUTH_PASSWORD is set, we need to check if the request has the correct password in auth header
7
+ const authPassword = process.env.TRIGGER_METRICS_AUTH_PASSWORD;
8
+
9
+ if (authPassword) {
10
+ const auth = request.headers.get("Authorization");
11
+ if (auth !== `Bearer ${authPassword}`) {
12
+ return new Response("Unauthorized", { status: 401 });
13
+ }
14
15
16
const prismaMetrics = await prisma.$metrics.prometheus();
17
const coreMetrics = await metricsRegister.metrics();
18
0 commit comments