-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathinstrumentation.ts
More file actions
34 lines (29 loc) · 1.01 KB
/
instrumentation.ts
File metadata and controls
34 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import * as Sentry from '@sentry/nextjs';
import { registerOTel } from '@vercel/otel';
import { LangfuseExporter } from 'langfuse-vercel';
export async function register() {
if (
process.env.LANGFUSE_SECRET_KEY &&
process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
) {
console.log("Registering Langfuse");
registerOTel({
serviceName: 'sourcebot',
traceExporter: new LangfuseExporter({
secretKey: process.env.LANGFUSE_SECRET_KEY,
publicKey: process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY,
baseUrl: process.env.NEXT_PUBLIC_LANGFUSE_BASE_URL,
}),
});
}
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('../sentry.server.config');
}
if (process.env.NEXT_RUNTIME === 'edge') {
await import('../sentry.edge.config');
}
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('./initialize');
}
}
export const onRequestError = Sentry.captureRequestError;