Add Sentry, Pino logs, and OTel spans on WS pipeline (M2).

Capture REST/WS/SSE errors in Sentry, emit structured pino logs with correlation IDs, and trace the book-tick pipeline to Sentry via OpenTelemetry.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Mauricio Barragan
2026-06-11 01:01:20 -06:00
co-authored by Cursor
parent f4def0c214
commit fd4170963e
22 changed files with 1280 additions and 50 deletions
+26
View File
@@ -0,0 +1,26 @@
import * as Sentry from "@sentry/node";
const dsn = process.env.SENTRY_DSN?.trim();
export function initSentry(): void {
if (!dsn) return;
Sentry.init({
dsn,
environment: process.env.NODE_ENV ?? "development",
tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1,
integrations: [Sentry.httpIntegration(), Sentry.expressIntegration()],
});
process.on("unhandledRejection", (reason) => {
Sentry.captureException(
reason instanceof Error ? reason : new Error(String(reason)),
);
});
process.on("uncaughtException", (error) => {
Sentry.captureException(error);
});
}
export { Sentry };