mirror of
https://github.com/mauricioabh/arbpulse.git
synced 2026-08-04 11:17:44 +00:00
Add Sentry dev probe and observability smoke test.
GET /api/debug/sentry, load .env.local for DSN, Playwright observability spec. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import "./load-env.js";
|
||||
import { initInstrumentation } from "./instrumentation/index.js";
|
||||
|
||||
initInstrumentation();
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
type Request,
|
||||
type Response,
|
||||
} from "express";
|
||||
import { Sentry } from "../../instrumentation/sentry.js";
|
||||
import type { ApplicationService } from "../../composition/application-service.js";
|
||||
import {
|
||||
bindRequestCorrelation,
|
||||
@@ -39,6 +40,15 @@ export function createRouter(app: ApplicationService, sse: SseHub): Router {
|
||||
res.json({ success: true, data: { status: "ok", ts: Date.now() } });
|
||||
});
|
||||
|
||||
router.get("/debug/sentry", (_req: Request, res: Response) => {
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
res.status(404).json({ error: "Not found" });
|
||||
return;
|
||||
}
|
||||
Sentry.captureException(new Error("Arb Pulse Sentry test error"));
|
||||
res.json({ ok: true, message: "Test error sent to Sentry" });
|
||||
});
|
||||
|
||||
router.get("/state", async (_req: Request, res: Response) => {
|
||||
const cached =
|
||||
await getCachedSnapshot<ReturnType<ApplicationService["getSnapshot"]>>();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { loadEnvFile } from "node:process";
|
||||
|
||||
for (const file of [".env.local", ".env"]) {
|
||||
if (existsSync(file)) {
|
||||
loadEnvFile(file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user