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:
co-authored by
Cursor
parent
f4def0c214
commit
fd4170963e
@@ -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 };
|
||||
Reference in New Issue
Block a user