Skip to content

config: Add OTEL setup for NextJS #2418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions frontends/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
"@mitodl/mitxonline-api-axios": "2025.7.28",
"@mitodl/smoot-design": "^6.10.0",
"@next/bundle-analyzer": "^14.2.15",
"@opentelemetry/api-logs": "^0.203.0",
"@opentelemetry/instrumentation": "^0.203.0",
"@opentelemetry/sdk-logs": "^0.203.0",
"@remixicon/react": "^4.2.0",
"@sentry/nextjs": "^9.0.0",
"@tanstack/react-query": "^5.66",
"@vercel/otel": "^1.13.0",
"api": "workspace:*",
"classnames": "^2.5.1",
"formik": "^2.4.6",
Expand Down
3 changes: 3 additions & 0 deletions frontends/main/src/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Added by @sentry/wizard
import * as Sentry from "@sentry/nextjs"
import { registerOTel } from "@vercel/otel"

export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
Expand All @@ -9,6 +10,8 @@ export async function register() {
if (process.env.NEXT_RUNTIME === "edge") {
await import("../sentry.edge.config")
}

registerOTel({ serviceName: process.env.OTEL_SERVICE_NAME || "mitlearn-frontend" })
}

export const onRequestError = Sentry.captureRequestError
88 changes: 88 additions & 0 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading