Skip to content

Commit c5581d7

Browse files
committed
config: Add OTEL setup for NextJS
1 parent 8ca3a45 commit c5581d7

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

frontends/main/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717
"@mitodl/mitxonline-api-axios": "2025.7.28",
1818
"@mitodl/smoot-design": "^6.10.0",
1919
"@next/bundle-analyzer": "^14.2.15",
20+
"@opentelemetry/api-logs": "^0.203.0",
21+
"@opentelemetry/instrumentation": "^0.203.0",
22+
"@opentelemetry/sdk-logs": "^0.203.0",
2023
"@remixicon/react": "^4.2.0",
2124
"@sentry/nextjs": "^9.0.0",
2225
"@tanstack/react-query": "^5.66",
26+
"@vercel/otel": "^1.13.0",
2327
"api": "workspace:*",
2428
"classnames": "^2.5.1",
2529
"formik": "^2.4.6",

frontends/main/src/instrumentation.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Added by @sentry/wizard
22
import * as Sentry from "@sentry/nextjs"
3+
import { registerOTel } from "@vercel/otel"
34

45
export async function register() {
56
if (process.env.NEXT_RUNTIME === "nodejs") {
@@ -9,6 +10,8 @@ export async function register() {
910
if (process.env.NEXT_RUNTIME === "edge") {
1011
await import("../sentry.edge.config")
1112
}
13+
14+
registerOTel({ serviceName: "mitlearn-frontend" })
1215
}
1316

1417
export const onRequestError = Sentry.captureRequestError

yarn.lock

Lines changed: 88 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)