Merged in fix/turn-off-application-insights (pull request #2764)
Fix/turn off application insights * remove applicationInsights * remove applicationInsights Approved-by: Linus Flood
This commit is contained in:
3
apps/scandic-web/env/server.ts
vendored
3
apps/scandic-web/env/server.ts
vendored
@@ -9,7 +9,6 @@ export const env = createEnv({
|
||||
*/
|
||||
isServer: typeof window === "undefined" || "Deno" in window,
|
||||
server: {
|
||||
APPLICATION_INSIGHTS_CONNECTION_STRING: z.string().optional(),
|
||||
ADOBE_SCRIPT_SRC: z.string().optional(),
|
||||
ADOBE_SDK_SCRIPT_SRC: z.string().optional(),
|
||||
ENABLE_GTMSCRIPT: z
|
||||
@@ -168,8 +167,6 @@ export const env = createEnv({
|
||||
},
|
||||
emptyStringAsUndefined: true,
|
||||
runtimeEnv: {
|
||||
APPLICATION_INSIGHTS_CONNECTION_STRING:
|
||||
process.env.APPLICATION_INSIGHTS_CONNECTION_STRING,
|
||||
ADOBE_SCRIPT_SRC: process.env.ADOBE_SCRIPT_SRC,
|
||||
ADOBE_SDK_SCRIPT_SRC: process.env.ADOBE_SDK_SCRIPT_SRC,
|
||||
ENABLE_GTMSCRIPT: process.env.ENABLE_GTMSCRIPT,
|
||||
|
||||
@@ -2,50 +2,12 @@ import * as Sentry from "@sentry/nextjs"
|
||||
|
||||
import { isEdge } from "@scandic-hotels/common/utils/isEdge"
|
||||
|
||||
import { env } from "./env/server"
|
||||
|
||||
export async function register() {
|
||||
/*
|
||||
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
|
||||
|
||||
async function configureApplicationInsights() {
|
||||
if (
|
||||
process.env.NEXT_RUNTIME === "nodejs" &&
|
||||
env.APPLICATION_INSIGHTS_CONNECTION_STRING
|
||||
) {
|
||||
const { AzureMonitorTraceExporter, AzureMonitorMetricExporter } =
|
||||
await import("@azure/monitor-opentelemetry-exporter")
|
||||
const { registerOTel } = await import("@vercel/otel")
|
||||
const { PeriodicExportingMetricReader } = await import(
|
||||
"@opentelemetry/sdk-metrics"
|
||||
)
|
||||
const connectionString: string = env.APPLICATION_INSIGHTS_CONNECTION_STRING
|
||||
const traceExporter = new AzureMonitorTraceExporter({ connectionString })
|
||||
const azureMetricExporter = new AzureMonitorMetricExporter({
|
||||
connectionString,
|
||||
})
|
||||
const azureMetricReader = new PeriodicExportingMetricReader({
|
||||
exporter: azureMetricExporter,
|
||||
exportIntervalMillis: 10000,
|
||||
})
|
||||
registerOTel({
|
||||
serviceName: "scandic-web",
|
||||
traceExporter,
|
||||
metricReader: azureMetricReader,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function configureSentry() {
|
||||
if (isEdge) {
|
||||
await import("./sentry.edge.config")
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
"check-types": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.31",
|
||||
"@contentstack/live-preview-utils": "^3.2.1",
|
||||
"@formatjs/intl": "^3.1.6",
|
||||
"@hookform/error-message": "^2.0.1",
|
||||
@@ -36,7 +35,6 @@
|
||||
"@opentelemetry/instrumentation": "^0.56.0",
|
||||
"@opentelemetry/resources": "^1.29.0",
|
||||
"@opentelemetry/sdk-logs": "^0.56.0",
|
||||
"@opentelemetry/sdk-metrics": "^1.25.1",
|
||||
"@opentelemetry/sdk-trace-base": "^1.29.0",
|
||||
"@radix-ui/react-slot": "^1.2.2",
|
||||
"@react-aria/ssr": "^3.9.8",
|
||||
@@ -57,7 +55,6 @@
|
||||
"@tsparticles/confetti": "^3.8.1",
|
||||
"@types/geojson": "^7946.0.16",
|
||||
"@types/supercluster": "^7.1.3",
|
||||
"@vercel/otel": "^1.12.0",
|
||||
"@vis.gl/react-google-maps": "^1.5.2",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"contentstack": "^3.25.3",
|
||||
|
||||
Reference in New Issue
Block a user