Skip to content
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
3 changes: 3 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ Affected SDKs: `@sentry/cloudflare`.

- The internal, deprecated `addAutoIpAddressToUser` export was removed.
- The `createSpanEnvelope` function and the `SpanEnvelope` / `SpanItem` types were removed. They existed only to send standalone (v1) spans as their own segment envelope, which the SDK no longer does. Standalone spans are gone; spans are sent either on their transaction or, with span streaming, as streamed spans (`StreamedSpanEnvelope`).
- The `disableInstrumentationWarnings` option and the `MissingInstrumentationContext` type were removed. Now that instrumentation is channel-based, the SDK can no longer detect the "you imported a framework before `Sentry.init()`" case, so the warning it gated and the context it attached no longer exist.
- The deprecated `sendDefaultPii` option was removed. Use [`dataCollection`](#senddefaultpii-is-replaced-by-datacollection) instead.
- The `_experiments.enableMetrics` and `_experiments.beforeSendMetric` options were removed, use the top-level `enableMetrics` and `beforeSendMetric` options instead.

Expand Down Expand Up @@ -411,6 +412,8 @@ Sentry.init({
- The deprecated `prismaInstrumentation` option was removed. It was no longer used, as Prisma works out of the box.
- The `registerEsmLoaderHooks` option was removed. All instrumentation is now channel-based (via `@sentry/server-utils`), so the SDK no longer registers `import-in-the-middle` ESM loader hooks and the option no longer had any effect.
- The deprecated `SentryHttpInstrumentation` and `SentryNodeFetchInstrumentation` exports were removed. Use `instrumentHttpOutgoingRequests()` and the `nativeNodeFetchIntegration` respectively.
- The `generateInstrumentOnce` export was removed (from `@sentry/node` and the framework SDKs that re-exported it). It wrapped OpenTelemetry's `registerInstrumentations` and is no longer needed now that instrumentation is channel-based.
- The `@sentry/node/loader` entry point was removed. Use `node --import @sentry/node/import` instead.
- (Fastify) The deprecated `setShouldHandleError` method was removed.
- (AWS Lambda) The deprecated `disableAwsContextPropagation` option was removed. It no longer had any effect.
- (AWS Lambda) The deprecated `startTrace` option was removed. It no longer had any effect; to disable tracing, set `tracesSampleRate` to `0`.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions dev-packages/rollup-utils/code/importHookTemplate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@sentry/server-utils/orchestrion/import-hook';
50 changes: 50 additions & 0 deletions dev-packages/rollup-utils/npmHelpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,53 @@ export function makeOtelLoaders(outputFolder, hookVariant, options = {}) {
},
]);
}

/**
* Emits the `@sentry/<framework>/import` entry (`build/import-hook.mjs`) as part of the rollup build,
* used as `node --import @sentry/<framework>/import app.js`. The generated hook imports
* `@sentry/server-utils/orchestrion/import-hook`, which registers the orchestrion
* diagnostics-channel injection, so the consuming package must declare `@sentry/server-utils` as a
* dependency.
*
* @param {string} outputFolder Build output folder.
*/
export function makeOrchestrionLoader(outputFolder) {
const expectedImportHookLocation = `${outputFolder}/import-hook.mjs`;
const foundImportHookExport = Object.keys(packageDotJSON.exports ?? {}).some(key => {
return packageDotJSON?.exports?.[key]?.import?.default === expectedImportHookLocation;
});
if (!foundImportHookExport) {
throw new Error(
`You used the makeOrchestrionLoader() rollup utility without specifying the import hook inside \`exports[something].import.default\`. Please add "${expectedImportHookLocation}" as a value there (maybe check for typos - it needs to be "${expectedImportHookLocation}" exactly).`,
);
}

const requiredDep = '@sentry/server-utils';
const foundRequiredDep =
Object.keys(packageDotJSON.dependencies ?? {}).some(key => {
return key === requiredDep;
}) ||
Object.keys(packageDotJSON.devDependencies ?? {}).some(key => {
return key === requiredDep;
});

if (!foundRequiredDep) {
throw new Error(
`You used the makeOrchestrionLoader() rollup utility but didn't specify the "${requiredDep}" dependency in ${path.resolve(
process.cwd(),
'package.json',
)}. Please add it to the dependencies.`,
);
}

return defineConfig([
{
input: path.join(__dirname, 'code', 'importHookTemplate.js'),
external: /.*/,
output: {
format: 'esm',
file: path.join(outputFolder, 'import-hook.mjs'),
},
},
]);
}
1 change: 0 additions & 1 deletion packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export {
flush,
fsIntegration,
functionToStringIntegration,
generateInstrumentOnce,
genericPoolIntegration,
getActiveSpan,
getAutoPerformanceIntegrations,
Expand Down
1 change: 0 additions & 1 deletion packages/aws-serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export {
getClient,
isInitialized,
isEnabled,
generateInstrumentOnce,
getCurrentScope,
getGlobalScope,
getIsolationScope,
Expand Down
1 change: 0 additions & 1 deletion packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export {
getClient,
isInitialized,
isEnabled,
generateInstrumentOnce,
getCurrentScope,
getGlobalScope,
getIsolationScope,
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/shared-exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ export type {
CultureContext,
TraceContext,
CloudResourceContext,
MissingInstrumentationContext,
} from './types/context';
export type { DataCategory } from './types/datacategory';
export type { DsnComponents, DsnLike, DsnProtocol } from './types/dsn';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tracing/spans/scopeContextAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Contexts } from '../../types/context';
/**
* Convert known scope contexts set by SDK integrations to span attributes.
* Only maps context keys that are relevant to browser SDKs.
* Server-only contexts (aws, gcp, missing_instrumentation, trpc) are handled
* Server-only contexts (aws, gcp, trpc) are handled
* by processSegmentSpan hooks in their respective packages.
*/
export function scopeContextsToSpanAttributes(contexts: Contexts): Record<string, unknown> {
Expand Down
5 changes: 0 additions & 5 deletions packages/core/src/types/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ export interface ProfileContext extends Record<string, unknown> {
profile_id: string;
}

export interface MissingInstrumentationContext extends Record<string, unknown> {
package: string;
['javascript.is_cjs']?: boolean;
}

/**
* Used to buffer flag evaluation data on the current scope and attach it to
* error events. `values` should be initialized as empty ([]), and modifying
Expand Down
6 changes: 0 additions & 6 deletions packages/core/src/types/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ export interface ServerRuntimeOptions {
*/
includeServerName?: boolean;

/**
* By default, the SDK will try to identify problems with your instrumentation setup and warn you about it.
* If you want to disable these warnings, set this to `true`.
*/
disableInstrumentationWarnings?: boolean;

/**
* Controls how many milliseconds to wait before shutting down. The default is 2 seconds. Setting this too low can cause
* problems for sending events from command line applications. Setting it too
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/utils/worldwide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export type InternalGlobal = {
* Keys are `error.stack` strings, values are the metadata.
*/
_sentryModuleMetadata?: Record<string, any>;
_sentryEsmLoaderHookRegistered?: boolean;
_sentryWrappedDepth?: number;
/**
* Orchestrion bundler and runtime detection.
Expand Down
1 change: 0 additions & 1 deletion packages/elysia/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export {
getClient,
isInitialized,
isEnabled,
generateInstrumentOnce,
getCurrentScope,
getGlobalScope,
getIsolationScope,
Expand Down
1 change: 0 additions & 1 deletion packages/google-cloud-serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export {
getClient,
isInitialized,
isEnabled,
generateInstrumentOnce,
getCurrentScope,
getGlobalScope,
getIsolationScope,
Expand Down
9 changes: 1 addition & 8 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
"default": "./build/import-hook.mjs"
}
},
"./loader": {
"import": {
"default": "./build/loader-hook.mjs"
}
},
"./init": {
"import": {
"default": "./build/esm/init.js"
Expand Down Expand Up @@ -100,7 +95,6 @@
"dependencies": {
"@opentelemetry/api": "^1.9.1",
"@opentelemetry/core": "^2.9.0",
"@opentelemetry/instrumentation": "^0.220.0",
"@sentry/conventions": "^0.16.0",
"@sentry/core": "10.67.0",
"@sentry/opentelemetry": "10.67.0",
Comment thread
andreiborza marked this conversation as resolved.
Expand Down Expand Up @@ -141,8 +135,7 @@
"{projectRoot}/build/cjs",
"{projectRoot}/build/npm/esm",
"{projectRoot}/build/npm/cjs",
"{projectRoot}/build/import-hook.mjs",
"{projectRoot}/build/loader-hook.mjs"
"{projectRoot}/build/import-hook.mjs"
]
}
}
Expand Down
11 changes: 4 additions & 7 deletions packages/node/rollup.npm.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import replace from '@rollup/plugin-replace';
import { makeBaseNPMConfig, makeNPMConfigVariants, makeOtelLoaders } from '@sentry-internal/rollup-utils';
import { makeBaseNPMConfig, makeNPMConfigVariants, makeOrchestrionLoader } from '@sentry-internal/rollup-utils';
import { createWorkerCodeBuilder } from './rollup.anr-worker.config.mjs';

const [anrWorkerConfig, getAnrBase64Code] = createWorkerCodeBuilder(
Expand All @@ -13,12 +13,9 @@ const [localVariablesWorkerConfig, getLocalVariablesBase64Code] = createWorkerCo
);

export default [
// `injectDiagnosticsChannel` makes the generated `@sentry/node/import` hook
// also register the diagnostics-channel injection, so `node --import
// @sentry/node/import app.js` injects the channels unconditionally (they are
// only subscribed to when the app opts in via
// `experimentalUseDiagnosticsChannelInjection()`).
...makeOtelLoaders('./build', 'otel', { injectDiagnosticsChannel: true }),
// The `@sentry/node/import` entry (`node --import @sentry/node/import app.js`), which registers
// the orchestrion diagnostics-channel injection before the app loads.
...makeOrchestrionLoader('./build'),
// The workers need to be built first since their output is copied into the main bundle.
anrWorkerConfig,
localVariablesWorkerConfig,
Expand Down
1 change: 0 additions & 1 deletion packages/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export { createGetModuleFromFilename } from './utils/module';
export { httpServerIntegration } from './integrations/http/httpServerIntegration';
export { httpServerSpansIntegration } from './integrations/http/httpServerSpansIntegration';
export { processSessionIntegration } from './integrations/processSession';
export { generateInstrumentOnce } from './otel/instrument';
export { NodeClient } from './sdk/client';
// eslint-disable-next-line typescript/no-deprecated
export { anrIntegration, disableAnrDetectionForCallback } from './integrations/anr';
Loading
Loading