From dfa863a3601771eb5a8ae858b31e79c708f3a652 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Thu, 20 Jun 2024 17:54:47 +0100 Subject: [PATCH] ref: Align `@sentry/node` exports from framework SDKs. (#12589) Aligns (and sorts) explicit exports from `@sentry/node` in Astro / Remix / Sveltekit SDKs. NextJS SDK does not seem to have explicit exports. --- .../instrument.mjs | 1 + packages/astro/src/index.server.ts | 168 +++++++++--------- packages/remix/src/index.server.ts | 156 +++++++++------- packages/sveltekit/src/server/index.ts | 142 +++++++++------ 4 files changed, 264 insertions(+), 203 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/instrument.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/instrument.mjs index 9d8e4e7fa408..5fb6bd039fdb 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/instrument.mjs +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/instrument.mjs @@ -7,4 +7,5 @@ Sentry.init({ dsn: process.env.E2E_TEST_DSN, tunnel: 'http://localhost:3031/', // proxy server autoInstrumentRemix: true, // auto instrument Remix + integrations: [Sentry.nativeNodeFetchIntegration()], }); diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index e9d809bae4d8..a235b6a16b83 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -8,117 +8,117 @@ import { handleRequest } from './server/middleware'; // Hence, we export everything from the Node SDK explicitly: export { - addEventProcessor, addBreadcrumb, - captureException, - captureEvent, - captureMessage, + addEventProcessor, + addIntegration, + addOpenTelemetryInstrumentation, + addRequestDataToEvent, + anrIntegration, captureCheckIn, + captureConsoleIntegration, + captureEvent, + captureException, captureFeedback, - withMonitor, + captureMessage, + captureSession, + close, + connectIntegration, + consoleIntegration, + contextLinesIntegration, + continueTrace, + createGetModuleFromFilename, createTransport, + cron, + debugIntegration, + dedupeIntegration, + DEFAULT_USER_INCLUDES, + defaultStackParser, + endSession, + expressErrorHandler, + expressIntegration, + extractRequestData, + extraErrorDataIntegration, + fastifyIntegration, + flush, + functionToStringIntegration, + generateInstrumentOnce, + getActiveSpan, + getAutoPerformanceIntegrations, + getClient, // eslint-disable-next-line deprecation/deprecation getCurrentHub, - getClient, - isInitialized, - generateInstrumentOnce, getCurrentScope, + getDefaultIntegrations, getGlobalScope, getIsolationScope, - setCurrentClient, - Scope, - SDK_VERSION, - setContext, - setExtra, - setExtras, - setTag, - setTags, - setUser, - getSpanStatusFromHttpCode, - setHttpStatus, - withScope, - withIsolationScope, - makeNodeTransport, - getDefaultIntegrations, - defaultStackParser, - lastEventId, - flush, - close, - getSentryRelease, - addRequestDataToEvent, - DEFAULT_USER_INCLUDES, - extractRequestData, - consoleIntegration, - onUncaughtExceptionIntegration, - onUnhandledRejectionIntegration, - modulesIntegration, - contextLinesIntegration, - nodeContextIntegration, - localVariablesIntegration, - requestDataIntegration, - functionToStringIntegration, - inboundFiltersIntegration, - linkedErrorsIntegration, - setMeasurement, - getActiveSpan, getRootSpan, - startSpan, - startInactiveSpan, - startSpanManual, - startNewTrace, - withActiveSpan, + getSentryRelease, getSpanDescendants, - continueTrace, - cron, - parameterize, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - expressIntegration, - expressErrorHandler, - setupExpressErrorHandler, - fastifyIntegration, + getSpanStatusFromHttpCode, graphqlIntegration, + hapiIntegration, + httpIntegration, + inboundFiltersIntegration, + initOpenTelemetry, + isInitialized, + koaIntegration, + lastEventId, + linkedErrorsIntegration, + localVariablesIntegration, + makeNodeTransport, + metrics, + modulesIntegration, mongoIntegration, mongooseIntegration, - mysqlIntegration, mysql2Integration, - redisIntegration, + mysqlIntegration, + nativeNodeFetchIntegration, nestIntegration, - setupNestErrorHandler, + NodeClient, + nodeContextIntegration, + onUncaughtExceptionIntegration, + onUnhandledRejectionIntegration, + parameterize, postgresIntegration, prismaIntegration, - hapiIntegration, - setupHapiErrorHandler, - spotlightIntegration, - addOpenTelemetryInstrumentation, - metrics, - NodeClient, - addIntegration, - anrIntegration, - captureConsoleIntegration, - captureSession, - connectIntegration, - createGetModuleFromFilename, - debugIntegration, - dedupeIntegration, - endSession, - extraErrorDataIntegration, - getAutoPerformanceIntegrations, - httpIntegration, - initOpenTelemetry, - koaIntegration, - nativeNodeFetchIntegration, + redisIntegration, + requestDataIntegration, rewriteFramesIntegration, + Scope, + SDK_VERSION, + SEMANTIC_ATTRIBUTE_SENTRY_OP, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, + SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, sessionTimingIntegration, + setContext, + setCurrentClient, + setExtra, + setExtras, + setHttpStatus, + setMeasurement, + setTag, + setTags, setupConnectErrorHandler, + setupExpressErrorHandler, + setupHapiErrorHandler, setupKoaErrorHandler, + setupNestErrorHandler, + setUser, spanToBaggageHeader, spanToJSON, spanToTraceHeader, + spotlightIntegration, + startInactiveSpan, + startNewTrace, startSession, + startSpan, + startSpanManual, trpcMiddleware, + withActiveSpan, + withIsolationScope, + withMonitor, + withScope, zodErrorsIntegration, } from '@sentry/node'; diff --git a/packages/remix/src/index.server.ts b/packages/remix/src/index.server.ts index 9ffc69a4ec12..bb2a0a125fd4 100644 --- a/packages/remix/src/index.server.ts +++ b/packages/remix/src/index.server.ts @@ -18,98 +18,118 @@ import type { RemixOptions } from './utils/remixOptions'; // We need to explicitly export @sentry/node as they end up under `default` in ESM builds // See: https://github.com/getsentry/sentry-javascript/issues/8474 export { - addEventProcessor, addBreadcrumb, + addEventProcessor, addIntegration, + addOpenTelemetryInstrumentation, + addRequestDataToEvent, + anrIntegration, captureCheckIn, - withMonitor, - captureException, + captureConsoleIntegration, captureEvent, - captureMessage, + captureException, captureFeedback, + captureMessage, + captureSession, + close, + connectIntegration, + consoleIntegration, + contextLinesIntegration, + continueTrace, + createGetModuleFromFilename, createTransport, + cron, + debugIntegration, + dedupeIntegration, + DEFAULT_USER_INCLUDES, + defaultStackParser, + endSession, + expressErrorHandler, + expressIntegration, + extractRequestData, + extraErrorDataIntegration, + fastifyIntegration, + flush, + functionToStringIntegration, + generateInstrumentOnce, + getActiveSpan, + getAutoPerformanceIntegrations, + getClient, // eslint-disable-next-line deprecation/deprecation getCurrentHub, - getClient, getCurrentScope, + getDefaultIntegrations, getGlobalScope, getIsolationScope, - setCurrentClient, - NodeClient, - Scope, - SDK_VERSION, - setContext, - setExtra, - setExtras, - setTag, - setTags, - setUser, - getSpanStatusFromHttpCode, - setHttpStatus, - withScope, - withIsolationScope, - makeNodeTransport, - defaultStackParser, - lastEventId, - flush, - close, - getSentryRelease, - addRequestDataToEvent, - DEFAULT_USER_INCLUDES, - extractRequestData, - consoleIntegration, - onUncaughtExceptionIntegration, - onUnhandledRejectionIntegration, - modulesIntegration, - contextLinesIntegration, - nodeContextIntegration, - localVariablesIntegration, - requestDataIntegration, - functionToStringIntegration, - inboundFiltersIntegration, - linkedErrorsIntegration, - setMeasurement, - getActiveSpan, getRootSpan, - startSpan, - startSpanManual, - startInactiveSpan, - startNewTrace, - withActiveSpan, + getSentryRelease, getSpanDescendants, - continueTrace, + getSpanStatusFromHttpCode, + graphqlIntegration, + hapiIntegration, + httpIntegration, + inboundFiltersIntegration, + initOpenTelemetry, isInitialized, - cron, - parameterize, + koaIntegration, + lastEventId, + linkedErrorsIntegration, + localVariablesIntegration, + makeNodeTransport, metrics, - createGetModuleFromFilename, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - expressIntegration, - expressErrorHandler, - setupExpressErrorHandler, - fastifyIntegration, - graphqlIntegration, + modulesIntegration, mongoIntegration, mongooseIntegration, - mysqlIntegration, mysql2Integration, - redisIntegration, + mysqlIntegration, + nativeNodeFetchIntegration, nestIntegration, - setupNestErrorHandler, + NodeClient, + nodeContextIntegration, + onUncaughtExceptionIntegration, + onUnhandledRejectionIntegration, + parameterize, postgresIntegration, prismaIntegration, - hapiIntegration, + redisIntegration, + requestDataIntegration, + rewriteFramesIntegration, + Scope, + SDK_VERSION, + SEMANTIC_ATTRIBUTE_SENTRY_OP, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, + SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + sessionTimingIntegration, + setContext, + setCurrentClient, + setExtra, + setExtras, + setHttpStatus, + setMeasurement, + setTag, + setTags, + setupConnectErrorHandler, + setupExpressErrorHandler, setupHapiErrorHandler, - spotlightIntegration, - setupFastifyErrorHandler, - trpcMiddleware, + setupKoaErrorHandler, + setupNestErrorHandler, + setUser, + spanToBaggageHeader, spanToJSON, spanToTraceHeader, - spanToBaggageHeader, - addOpenTelemetryInstrumentation, + spotlightIntegration, + startInactiveSpan, + startNewTrace, + startSession, + startSpan, + startSpanManual, + trpcMiddleware, + withActiveSpan, + withIsolationScope, + withMonitor, + withScope, + zodErrorsIntegration, } from '@sentry/node'; // Keeping the `*` exports for backwards compatibility and types diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index c8b97029e456..3a14771218e4 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -4,78 +4,118 @@ // on the top - level namespace. // Hence, we export everything from the Node SDK explicitly: export { - addEventProcessor, addBreadcrumb, + addEventProcessor, addIntegration, - captureException, - captureEvent, - captureMessage, + addOpenTelemetryInstrumentation, + addRequestDataToEvent, + anrIntegration, captureCheckIn, + captureConsoleIntegration, + captureEvent, + captureException, captureFeedback, - withMonitor, + captureMessage, + captureSession, + close, + connectIntegration, + consoleIntegration, + contextLinesIntegration, + continueTrace, + createGetModuleFromFilename, createTransport, + cron, + debugIntegration, + dedupeIntegration, + DEFAULT_USER_INCLUDES, + defaultStackParser, + endSession, + expressErrorHandler, + expressIntegration, + extractRequestData, + extraErrorDataIntegration, + fastifyIntegration, + flush, + functionToStringIntegration, + generateInstrumentOnce, + getActiveSpan, + getAutoPerformanceIntegrations, getClient, - isInitialized, + // eslint-disable-next-line deprecation/deprecation + getCurrentHub, getCurrentScope, + getDefaultIntegrations, getGlobalScope, getIsolationScope, + getRootSpan, + getSentryRelease, + getSpanDescendants, + getSpanStatusFromHttpCode, + graphqlIntegration, + hapiIntegration, + httpIntegration, + inboundFiltersIntegration, + initOpenTelemetry, + isInitialized, + koaIntegration, + lastEventId, + linkedErrorsIntegration, + localVariablesIntegration, + makeNodeTransport, + metrics, + modulesIntegration, + mongoIntegration, + mongooseIntegration, + mysql2Integration, + mysqlIntegration, + nativeNodeFetchIntegration, + nestIntegration, NodeClient, - setCurrentClient, + nodeContextIntegration, + onUncaughtExceptionIntegration, + onUnhandledRejectionIntegration, + parameterize, + postgresIntegration, + prismaIntegration, + redisIntegration, + requestDataIntegration, + rewriteFramesIntegration, Scope, SDK_VERSION, + SEMANTIC_ATTRIBUTE_SENTRY_OP, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, + SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + sessionTimingIntegration, setContext, + setCurrentClient, setExtra, setExtras, + setHttpStatus, + setMeasurement, setTag, setTags, + setupConnectErrorHandler, + setupExpressErrorHandler, + setupHapiErrorHandler, + setupKoaErrorHandler, + setupNestErrorHandler, setUser, - getSpanStatusFromHttpCode, - setHttpStatus, - withScope, - withIsolationScope, - makeNodeTransport, - getDefaultIntegrations, - defaultStackParser, - lastEventId, - flush, - close, - getSentryRelease, - addRequestDataToEvent, - DEFAULT_USER_INCLUDES, - extractRequestData, - consoleIntegration, - onUncaughtExceptionIntegration, - onUnhandledRejectionIntegration, - modulesIntegration, - contextLinesIntegration, - nodeContextIntegration, - localVariablesIntegration, - requestDataIntegration, - functionToStringIntegration, - inboundFiltersIntegration, - linkedErrorsIntegration, - setMeasurement, - getActiveSpan, - getRootSpan, - startSpan, + spanToBaggageHeader, + spanToJSON, + spanToTraceHeader, + spotlightIntegration, startInactiveSpan, - startSpanManual, startNewTrace, - withActiveSpan, - continueTrace, - cron, - parameterize, - createGetModuleFromFilename, - metrics, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, + startSession, + startSpan, + startSpanManual, trpcMiddleware, - spanToJSON, - spanToTraceHeader, - spanToBaggageHeader, - addOpenTelemetryInstrumentation, + withActiveSpan, + withIsolationScope, + withMonitor, + withScope, + zodErrorsIntegration, } from '@sentry/node'; // We can still leave this for the carrier init and type exports