diff --git a/instrumentation.ts b/instrumentation.ts index 13176a506..0268d8e78 100644 --- a/instrumentation.ts +++ b/instrumentation.ts @@ -3,8 +3,15 @@ import * as Sentry from "@sentry/nextjs" import { env } from "./env/server" export async function register() { - await configureSentry() + /* + Order matters! + + Sentry hooks into OpenTelemetry, modifying its behavior. + Application Insights relies on OpenTelemetry exporters, + and these may not work correctly if Sentry has already altered the instrumentation pipeline. + */ await configureApplicationInsights() + await configureSentry() } export const onRequestError = Sentry.captureRequestError