diff --git a/packages/bun/test/helpers.ts b/packages/bun/test/helpers.ts index 32d4e4d716ac..61b4de5e65f1 100644 --- a/packages/bun/test/helpers.ts +++ b/packages/bun/test/helpers.ts @@ -8,7 +8,6 @@ export function getDefaultBunClientOptions(options: Partial = integrations: [], transport: () => createTransport({ recordDroppedEvent: () => undefined }, _ => resolvedSyncPromise({})), stackParser: () => [], - instrumenter: 'sentry', ...options, }; } diff --git a/packages/core/src/tracing/hubextensions.ts b/packages/core/src/tracing/hubextensions.ts index f705f676e660..5f30a94498b9 100644 --- a/packages/core/src/tracing/hubextensions.ts +++ b/packages/core/src/tracing/hubextensions.ts @@ -1,8 +1,6 @@ import type { ClientOptions, CustomSamplingContext, Hub, TransactionContext } from '@sentry/types'; -import { logger } from '@sentry/utils'; import { getMainCarrier } from '../asyncContext'; -import { DEBUG_BUILD } from '../debug-build'; import { registerErrorInstrumentation } from './errors'; import { IdleTransaction } from './idletransaction'; import { sampleTransaction } from './sampling'; @@ -32,19 +30,6 @@ function _startTransaction( const client = this.getClient(); const options: Partial = (client && client.getOptions()) || {}; - const configInstrumenter = options.instrumenter || 'sentry'; - const transactionInstrumenter = transactionContext.instrumenter || 'sentry'; - - if (configInstrumenter !== transactionInstrumenter) { - DEBUG_BUILD && - logger.error( - `A transaction was started with instrumenter=\`${transactionInstrumenter}\`, but the SDK is configured with the \`${configInstrumenter}\` instrumenter. -The transaction will not be sampled. Please use the ${configInstrumenter} instrumentation to start transactions.`, - ); - - transactionContext.sampled = false; - } - // eslint-disable-next-line deprecation/deprecation let transaction = new Transaction(transactionContext, this); transaction = sampleTransaction(transaction, options, { diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index 2f1fa54c5306..f74050b24223 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -1,5 +1,4 @@ import type { - Instrumenter, Primitive, Span as SpanInterface, SpanAttributeValue, @@ -90,18 +89,6 @@ export class SentrySpan implements SpanInterface { * @deprecated Use top level `Sentry.getRootSpan()` instead */ public transaction?: Transaction; - - /** - * The instrumenter that created this span. - * - * TODO (v8): This can probably be replaced by an `instanceOf` check of the span class. - * the instrumenter can only be sentry or otel so we can check the span instance - * to verify which one it is and remove this field entirely. - * - * @deprecated This field will be removed. - */ - public instrumenter: Instrumenter; - protected _traceId: string; protected _spanId: string; protected _parentSpanId?: string | undefined; @@ -132,8 +119,6 @@ export class SentrySpan implements SpanInterface { this.tags = spanContext.tags ? { ...spanContext.tags } : {}; // eslint-disable-next-line deprecation/deprecation this.data = spanContext.data ? { ...spanContext.data } : {}; - // eslint-disable-next-line deprecation/deprecation - this.instrumenter = spanContext.instrumenter || 'sentry'; this._attributes = {}; this.setAttributes({ diff --git a/packages/core/test/lib/serverruntimeclient.test.ts b/packages/core/test/lib/serverruntimeclient.test.ts index 4d5cc8f33ce4..ee5d96863174 100644 --- a/packages/core/test/lib/serverruntimeclient.test.ts +++ b/packages/core/test/lib/serverruntimeclient.test.ts @@ -11,7 +11,6 @@ function getDefaultClientOptions(options: Partial = integrations: [], transport: () => createTransport({ recordDroppedEvent: () => undefined }, _ => Promise.resolve({})), stackParser: () => [], - instrumenter: 'sentry', ...options, }; } diff --git a/packages/nextjs/src/common/wrapAppGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/wrapAppGetInitialPropsWithSentry.ts index 11730529de23..50bbd346fcd2 100644 --- a/packages/nextjs/src/common/wrapAppGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/wrapAppGetInitialPropsWithSentry.ts @@ -1,7 +1,6 @@ import { addTracingExtensions, getActiveSpan, - getClient, getDynamicSamplingContextFromSpan, getRootSpan, spanToTraceHeader, @@ -35,13 +34,11 @@ export function wrapAppGetInitialPropsWithSentry(origAppGetInitialProps: AppGetI const { req, res } = context.ctx; const errorWrappedAppGetInitialProps = withErrorInstrumentation(wrappingTarget); - const options = getClient()?.getOptions(); - // Generally we can assume that `req` and `res` are always defined on the server: // https://nextjs.org/docs/api-reference/data-fetching/get-initial-props#context-object // This does not seem to be the case in dev mode. Because we have no clean way of associating the the data fetcher // span with each other when there are no req or res objects, we simply do not trace them at all here. - if (req && res && options?.instrumenter === 'sentry') { + if (req && res) { const tracedGetInitialProps = withTracedServerSideDataFetcher(errorWrappedAppGetInitialProps, req, res, { dataFetcherRouteName: '/_app', requestedRouteName: context.ctx.pathname, diff --git a/packages/nextjs/src/common/wrapDocumentGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/wrapDocumentGetInitialPropsWithSentry.ts index 695111429938..9c903a1fa795 100644 --- a/packages/nextjs/src/common/wrapDocumentGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/wrapDocumentGetInitialPropsWithSentry.ts @@ -1,4 +1,4 @@ -import { addTracingExtensions, getClient } from '@sentry/core'; +import { addTracingExtensions } from '@sentry/core'; import type Document from 'next/document'; import { isBuild } from './utils/isBuild'; @@ -29,13 +29,11 @@ export function wrapDocumentGetInitialPropsWithSentry( const { req, res } = context; const errorWrappedGetInitialProps = withErrorInstrumentation(wrappingTarget); - const options = getClient()?.getOptions(); - // Generally we can assume that `req` and `res` are always defined on the server: // https://nextjs.org/docs/api-reference/data-fetching/get-initial-props#context-object // This does not seem to be the case in dev mode. Because we have no clean way of associating the the data fetcher // span with each other when there are no req or res objects, we simply do not trace them at all here. - if (req && res && options?.instrumenter === 'sentry') { + if (req && res) { const tracedGetInitialProps = withTracedServerSideDataFetcher(errorWrappedGetInitialProps, req, res, { dataFetcherRouteName: '/_document', requestedRouteName: context.pathname, diff --git a/packages/nextjs/src/common/wrapErrorGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/wrapErrorGetInitialPropsWithSentry.ts index 44121a8c2e4a..aeeccd332213 100644 --- a/packages/nextjs/src/common/wrapErrorGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/wrapErrorGetInitialPropsWithSentry.ts @@ -1,7 +1,6 @@ import { addTracingExtensions, getActiveSpan, - getClient, getDynamicSamplingContextFromSpan, getRootSpan, spanToTraceHeader, @@ -38,13 +37,11 @@ export function wrapErrorGetInitialPropsWithSentry( const { req, res } = context; const errorWrappedGetInitialProps = withErrorInstrumentation(wrappingTarget); - const options = getClient()?.getOptions(); - // Generally we can assume that `req` and `res` are always defined on the server: // https://nextjs.org/docs/api-reference/data-fetching/get-initial-props#context-object // This does not seem to be the case in dev mode. Because we have no clean way of associating the the data fetcher // span with each other when there are no req or res objects, we simply do not trace them at all here. - if (req && res && options?.instrumenter === 'sentry') { + if (req && res) { const tracedGetInitialProps = withTracedServerSideDataFetcher(errorWrappedGetInitialProps, req, res, { dataFetcherRouteName: '/_error', requestedRouteName: context.pathname, diff --git a/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts index add8af0c0f8f..c78ce497e394 100644 --- a/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts @@ -1,7 +1,6 @@ import { addTracingExtensions, getActiveSpan, - getClient, getDynamicSamplingContextFromSpan, getRootSpan, spanToTraceHeader, @@ -34,13 +33,11 @@ export function wrapGetInitialPropsWithSentry(origGetInitialProps: GetInitialPro const { req, res } = context; const errorWrappedGetInitialProps = withErrorInstrumentation(wrappingTarget); - const options = getClient()?.getOptions(); - // Generally we can assume that `req` and `res` are always defined on the server: // https://nextjs.org/docs/api-reference/data-fetching/get-initial-props#context-object // This does not seem to be the case in dev mode. Because we have no clean way of associating the the data fetcher // span with each other when there are no req or res objects, we simply do not trace them at all here. - if (req && res && options?.instrumenter === 'sentry') { + if (req && res) { const tracedGetInitialProps = withTracedServerSideDataFetcher(errorWrappedGetInitialProps, req, res, { dataFetcherRouteName: context.pathname, requestedRouteName: context.pathname, diff --git a/packages/nextjs/src/common/wrapGetServerSidePropsWithSentry.ts b/packages/nextjs/src/common/wrapGetServerSidePropsWithSentry.ts index f854cedd8b5d..32122869b8f4 100644 --- a/packages/nextjs/src/common/wrapGetServerSidePropsWithSentry.ts +++ b/packages/nextjs/src/common/wrapGetServerSidePropsWithSentry.ts @@ -1,7 +1,6 @@ import { addTracingExtensions, getActiveSpan, - getClient, getDynamicSamplingContextFromSpan, getRootSpan, spanToTraceHeader, @@ -35,34 +34,28 @@ export function wrapGetServerSidePropsWithSentry( const { req, res } = context; const errorWrappedGetServerSideProps = withErrorInstrumentation(wrappingTarget); - const options = getClient()?.getOptions(); - - if (options?.instrumenter === 'sentry') { - const tracedGetServerSideProps = withTracedServerSideDataFetcher(errorWrappedGetServerSideProps, req, res, { - dataFetcherRouteName: parameterizedRoute, - requestedRouteName: parameterizedRoute, - dataFetchingMethodName: 'getServerSideProps', - }); - - const serverSideProps = await (tracedGetServerSideProps.apply(thisArg, args) as ReturnType< - typeof tracedGetServerSideProps - >); - - if (serverSideProps && 'props' in serverSideProps) { - const activeSpan = getActiveSpan(); - const requestTransaction = getSpanFromRequest(req) ?? (activeSpan ? getRootSpan(activeSpan) : undefined); - if (requestTransaction) { - serverSideProps.props._sentryTraceData = spanToTraceHeader(requestTransaction); - - const dynamicSamplingContext = getDynamicSamplingContextFromSpan(requestTransaction); - serverSideProps.props._sentryBaggage = dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext); - } + const tracedGetServerSideProps = withTracedServerSideDataFetcher(errorWrappedGetServerSideProps, req, res, { + dataFetcherRouteName: parameterizedRoute, + requestedRouteName: parameterizedRoute, + dataFetchingMethodName: 'getServerSideProps', + }); + + const serverSideProps = await (tracedGetServerSideProps.apply(thisArg, args) as ReturnType< + typeof tracedGetServerSideProps + >); + + if (serverSideProps && 'props' in serverSideProps) { + const activeSpan = getActiveSpan(); + const requestTransaction = getSpanFromRequest(req) ?? (activeSpan ? getRootSpan(activeSpan) : undefined); + if (requestTransaction) { + serverSideProps.props._sentryTraceData = spanToTraceHeader(requestTransaction); + + const dynamicSamplingContext = getDynamicSamplingContextFromSpan(requestTransaction); + serverSideProps.props._sentryBaggage = dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext); } - - return serverSideProps; - } else { - return errorWrappedGetServerSideProps.apply(thisArg, args); } + + return serverSideProps; }, }); } diff --git a/packages/nextjs/src/common/wrapGetStaticPropsWithSentry.ts b/packages/nextjs/src/common/wrapGetStaticPropsWithSentry.ts index 1d5c0b1890de..67ac97daac5c 100644 --- a/packages/nextjs/src/common/wrapGetStaticPropsWithSentry.ts +++ b/packages/nextjs/src/common/wrapGetStaticPropsWithSentry.ts @@ -1,4 +1,4 @@ -import { addTracingExtensions, getClient } from '@sentry/core'; +import { addTracingExtensions } from '@sentry/core'; import type { GetStaticProps } from 'next'; import { isBuild } from './utils/isBuild'; @@ -26,14 +26,10 @@ export function wrapGetStaticPropsWithSentry( addTracingExtensions(); const errorWrappedGetStaticProps = withErrorInstrumentation(wrappingTarget); - const options = getClient()?.getOptions(); - - if (options?.instrumenter === 'sentry') { - return callDataFetcherTraced(errorWrappedGetStaticProps, args, { - parameterizedRoute, - dataFetchingMethodName: 'getStaticProps', - }); - } + return callDataFetcherTraced(errorWrappedGetStaticProps, args, { + parameterizedRoute, + dataFetchingMethodName: 'getStaticProps', + }); return errorWrappedGetStaticProps.apply(thisArg, args); }, diff --git a/packages/nextjs/test/config/wrappers.test.ts b/packages/nextjs/test/config/wrappers.test.ts index b15af158a098..e1791e3996d5 100644 --- a/packages/nextjs/test/config/wrappers.test.ts +++ b/packages/nextjs/test/config/wrappers.test.ts @@ -23,7 +23,7 @@ describe('data-fetching function wrappers should create spans', () => { jest.spyOn(SentryCore, 'hasTracingEnabled').mockReturnValue(true); jest.spyOn(SentryCore, 'getClient').mockImplementation(() => { return { - getOptions: () => ({ instrumenter: 'sentry' }), + getOptions: () => ({}), getDsn: () => {}, } as Client; }); diff --git a/packages/node-experimental/src/sdk/init.ts b/packages/node-experimental/src/sdk/init.ts index 2b41c235b234..80b69112f261 100644 --- a/packages/node-experimental/src/sdk/init.ts +++ b/packages/node-experimental/src/sdk/init.ts @@ -153,7 +153,6 @@ function getClientOptions(options: NodeOptions): NodeClientOptions { ...baseOptions, ...options, ...overwriteOptions, - instrumenter: 'otel', stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser), integrations: getIntegrationsToSetup({ defaultIntegrations: options.defaultIntegrations, diff --git a/packages/node/src/handlers.ts b/packages/node/src/handlers.ts index b66315afcb73..5c1c0a26e481 100644 --- a/packages/node/src/handlers.ts +++ b/packages/node/src/handlers.ts @@ -48,12 +48,7 @@ export function tracingHandler(): ( ): void { const options = getClient()?.getOptions(); - if ( - !options || - options.instrumenter !== 'sentry' || - req.method?.toUpperCase() === 'OPTIONS' || - req.method?.toUpperCase() === 'HEAD' - ) { + if (req.method?.toUpperCase() === 'OPTIONS' || req.method?.toUpperCase() === 'HEAD') { return next(); } diff --git a/packages/node/src/integrations/http.ts b/packages/node/src/integrations/http.ts index b8010b083d5b..22407ca77e91 100644 --- a/packages/node/src/integrations/http.ts +++ b/packages/node/src/integrations/http.ts @@ -185,12 +185,6 @@ export class Http implements Integration { return; } - // Do not auto-instrument for other instrumenter - if (clientOptions && clientOptions.instrumenter !== 'sentry') { - DEBUG_BUILD && logger.log('HTTP Integration is skipped because of instrumenter configuration.'); - return; - } - const shouldCreateSpanForRequest = _getShouldCreateSpanForRequest(shouldCreateSpans, this._tracing, clientOptions); // eslint-disable-next-line deprecation/deprecation diff --git a/packages/node/src/sdk.ts b/packages/node/src/sdk.ts index d39d853c7bbc..1225cce83485 100644 --- a/packages/node/src/sdk.ts +++ b/packages/node/src/sdk.ts @@ -147,10 +147,6 @@ export function init(options: NodeOptions = {}): void { options.autoSessionTracking = true; } - if (options.instrumenter === undefined) { - options.instrumenter = 'sentry'; - } - // TODO(v7): Refactor this to reduce the logic above const clientOptions: NodeClientOptions = { ...options, diff --git a/packages/node/test/helper/node-client-options.ts b/packages/node/test/helper/node-client-options.ts index 9103174ad813..e9428ea0bb7e 100644 --- a/packages/node/test/helper/node-client-options.ts +++ b/packages/node/test/helper/node-client-options.ts @@ -8,7 +8,6 @@ export function getDefaultNodeClientOptions(options: Partial integrations: [], transport: () => createTransport({ recordDroppedEvent: () => undefined }, _ => resolvedSyncPromise({})), stackParser: () => [], - instrumenter: 'sentry', ...options, }; } diff --git a/packages/node/test/index.test.ts b/packages/node/test/index.test.ts index 3b9a52272b61..563fa8886420 100644 --- a/packages/node/test/index.test.ts +++ b/packages/node/test/index.test.ts @@ -26,7 +26,6 @@ import { import { setNodeAsyncContextStrategy } from '../src/async'; import { ContextLines } from '../src/integrations'; import { defaultStackParser, getDefaultIntegrations } from '../src/sdk'; -import type { NodeClientOptions } from '../src/types'; import { getDefaultNodeClientOptions } from './helper/node-client-options'; jest.mock('@sentry/core', () => { @@ -487,24 +486,6 @@ describe('SentryNode initialization', () => { }); }); - describe('instrumenter', () => { - it('defaults to sentry instrumenter', () => { - init({ dsn }); - - const instrumenter = (getClient()?.getOptions() as NodeClientOptions).instrumenter; - - expect(instrumenter).toEqual('sentry'); - }); - - it('allows to set instrumenter', () => { - init({ dsn, instrumenter: 'otel' }); - - const instrumenter = (getClient()?.getOptions() as NodeClientOptions).instrumenter; - - expect(instrumenter).toEqual('otel'); - }); - }); - describe('propagation context', () => { beforeEach(() => { process.env.SENTRY_TRACE = '12312012123120121231201212312012-1121201211212012-0'; diff --git a/packages/node/test/integrations/http.test.ts b/packages/node/test/integrations/http.test.ts index c2e85f8ac170..0a0f8f16645b 100644 --- a/packages/node/test/integrations/http.test.ts +++ b/packages/node/test/integrations/http.test.ts @@ -7,7 +7,7 @@ import { Transaction } from '@sentry/core'; import { getCurrentScope, setUser, spanToJSON, startInactiveSpan } from '@sentry/core'; import { addTracingExtensions } from '@sentry/core'; import type { TransactionContext } from '@sentry/types'; -import { TRACEPARENT_REGEXP, logger } from '@sentry/utils'; +import { TRACEPARENT_REGEXP } from '@sentry/utils'; import * as nock from 'nock'; import { HttpsProxyAgent } from '../../src/proxy'; @@ -259,33 +259,6 @@ describe('tracing', () => { expect(baggage).not.toBeDefined(); }); - it("doesn't attach when using otel instrumenter", () => { - const loggerLogSpy = jest.spyOn(logger, 'log'); - - const options = getDefaultNodeClientOptions({ - dsn: 'https://dogsarebadatkeepingsecrets@squirrelchasers.ingest.sentry.io/12312012', - tracesSampleRate: 1.0, - // eslint-disable-next-line deprecation/deprecation - integrations: [new HttpIntegration({ tracing: true })], - release: '1.0.0', - environment: 'production', - instrumenter: 'otel', - }); - const client = new NodeClient(options); - setCurrentClient(client); - // eslint-disable-next-line deprecation/deprecation - const hub = getCurrentHub(); - - // eslint-disable-next-line deprecation/deprecation - const integration = new HttpIntegration(); - integration.setupOnce( - () => {}, - () => hub as Hub, - ); - - expect(loggerLogSpy).toBeCalledWith('HTTP Integration is skipped because of instrumenter configuration.'); - }); - it('omits query and fragment from description and adds to span data instead', () => { nock('http://dogs.are.great').get('/spaniel?tail=wag&cute=true#learn-more').reply(200); diff --git a/packages/opentelemetry-node/README.md b/packages/opentelemetry-node/README.md index b75ca0ab0ef8..5d09f0edb182 100644 --- a/packages/opentelemetry-node/README.md +++ b/packages/opentelemetry-node/README.md @@ -54,8 +54,6 @@ const { Sentry.init({ dsn: '__DSN__', tracesSampleRate: 1.0, - // set the instrumenter to use OpenTelemetry instead of Sentry - instrumenter: 'otel', // ... }); diff --git a/packages/opentelemetry-node/src/spanprocessor.ts b/packages/opentelemetry-node/src/spanprocessor.ts index 71a643a5b90b..4ef437a6e88e 100644 --- a/packages/opentelemetry-node/src/spanprocessor.ts +++ b/packages/opentelemetry-node/src/spanprocessor.ts @@ -67,7 +67,6 @@ export class SentrySpanProcessor implements OtelSpanProcessor { // eslint-disable-next-line deprecation/deprecation const sentryChildSpan = sentryParentSpan.startChild({ name: otelSpan.name, - instrumenter: 'otel', startTimestamp: convertOtelTimeToSeconds(otelSpan.startTime), spanId: otelSpanId, }); @@ -80,7 +79,6 @@ export class SentrySpanProcessor implements OtelSpanProcessor { name: otelSpan.name, ...traceCtx, attributes: otelSpan.attributes, - instrumenter: 'otel', startTimestamp: convertOtelTimeToSeconds(otelSpan.startTime), spanId: otelSpanId, }); diff --git a/packages/opentelemetry/README.md b/packages/opentelemetry/README.md index 593c5a280868..18ae5e9572d0 100644 --- a/packages/opentelemetry/README.md +++ b/packages/opentelemetry/README.md @@ -38,13 +38,13 @@ This package exposes a few building blocks you can add to your OpenTelemetry set This is how you can use this in your app: -1. Initialize Sentry, e.g. `@sentry/node` - make sure to set `instrumenter: 'otel'` in the SDK `init({})`! -1. Call `setupEventContextTrace(client)` -1. Add `SentrySampler` as sampler -1. Add `SentrySpanProcessor` as span processor -1. Add a context manager wrapped via `wrapContextManagerClass` -1. Add `SentryPropagator` as propagator -1. Setup OTEL-powered async context strategy for Sentry via `setOpenTelemetryContextAsyncContextStrategy()` +1. Initialize Sentry, e.g. `@sentry/node`! +2. Call `setupEventContextTrace(client)` +3. Add `SentrySampler` as sampler +4. Add `SentrySpanProcessor` as span processor +5. Add a context manager wrapped via `wrapContextManagerClass` +6. Add `SentryPropagator` as propagator +7. Setup OTEL-powered async context strategy for Sentry via `setOpenTelemetryContextAsyncContextStrategy()` For example, you could set this up as follows: @@ -63,7 +63,6 @@ import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-ho function setupSentry() { Sentry.init({ dsn: 'xxx', - instrumenter: 'otel' }); const client = Sentry.getClient(); diff --git a/packages/opentelemetry/src/spanExporter.ts b/packages/opentelemetry/src/spanExporter.ts index 2c3a4c677b39..a0488ac22f64 100644 --- a/packages/opentelemetry/src/spanExporter.ts +++ b/packages/opentelemetry/src/spanExporter.ts @@ -156,7 +156,6 @@ function createTransactionForOtelSpan(span: ReadableSpan): Transaction { parentSampled, name: description, op, - instrumenter: 'otel', status: mapStatus(span), startTimestamp: convertOtelTimeToSeconds(span.startTime), metadata: { @@ -213,7 +212,6 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry op, data: allData, status: mapStatus(span), - instrumenter: 'otel', startTimestamp: convertOtelTimeToSeconds(span.startTime), spanId, origin, diff --git a/packages/opentelemetry/test/helpers/mockSdkInit.ts b/packages/opentelemetry/test/helpers/mockSdkInit.ts index f77c37ce4034..d4a41f90959e 100644 --- a/packages/opentelemetry/test/helpers/mockSdkInit.ts +++ b/packages/opentelemetry/test/helpers/mockSdkInit.ts @@ -13,13 +13,8 @@ const PUBLIC_DSN = 'https://username@domain/123'; * Initialize Sentry for Node. */ function init(options: Partial | undefined = {}): void { - const fullOptions: Partial = { - instrumenter: 'otel', - ...options, - }; - setOpenTelemetryContextAsyncContextStrategy(); - initTestClient(fullOptions); + initTestClient(options); initOtel(); } diff --git a/packages/tracing-internal/src/node/integrations/apollo.ts b/packages/tracing-internal/src/node/integrations/apollo.ts index 85029943cbaf..d2a7f0ff73ee 100644 --- a/packages/tracing-internal/src/node/integrations/apollo.ts +++ b/packages/tracing-internal/src/node/integrations/apollo.ts @@ -4,7 +4,6 @@ import { arrayify, fill, isThenable, loadModule, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../common/debug-build'; import type { LazyLoadedIntegration } from './lazy'; -import { shouldDisableAutoInstrumentation } from './utils/node-utils'; interface ApolloOptions { useNestjs?: boolean; @@ -77,11 +76,6 @@ export class Apollo implements LazyLoadedIntegration void, getCurrentHub: () => Hub): void { - if (shouldDisableAutoInstrumentation(getCurrentHub)) { - DEBUG_BUILD && logger.log('Apollo Integration is skipped because of instrumenter configuration.'); - return; - } - if (this._useNest) { const pkg = this.loadDependency(); diff --git a/packages/tracing-internal/src/node/integrations/express.ts b/packages/tracing-internal/src/node/integrations/express.ts index 04f3e55dec68..e1417c0f1773 100644 --- a/packages/tracing-internal/src/node/integrations/express.ts +++ b/packages/tracing-internal/src/node/integrations/express.ts @@ -1,6 +1,6 @@ /* eslint-disable max-lines */ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON } from '@sentry/core'; -import type { Hub, Integration, PolymorphicRequest, Transaction } from '@sentry/types'; +import type { Integration, PolymorphicRequest, Transaction } from '@sentry/types'; import { GLOBAL_OBJ, extractPathForTransaction, @@ -11,7 +11,6 @@ import { } from '@sentry/utils'; import { DEBUG_BUILD } from '../../common/debug-build'; -import { shouldDisableAutoInstrumentation } from './utils/node-utils'; type Method = | 'all' @@ -119,17 +118,12 @@ export class Express implements Integration { /** * @inheritDoc */ - public setupOnce(_: unknown, getCurrentHub: () => Hub): void { + public setupOnce(_: unknown): void { if (!this._router) { DEBUG_BUILD && logger.error('ExpressIntegration is missing an Express instance'); return; } - if (shouldDisableAutoInstrumentation(getCurrentHub)) { - DEBUG_BUILD && logger.log('Express Integration is skipped because of instrumenter configuration.'); - return; - } - instrumentMiddlewares(this._router, this._methods); instrumentRouter(this._router as ExpressRouter); } diff --git a/packages/tracing-internal/src/node/integrations/graphql.ts b/packages/tracing-internal/src/node/integrations/graphql.ts index 4ce7476a45ac..16256e0dccab 100644 --- a/packages/tracing-internal/src/node/integrations/graphql.ts +++ b/packages/tracing-internal/src/node/integrations/graphql.ts @@ -4,7 +4,6 @@ import { fill, isThenable, loadModule, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../common/debug-build'; import type { LazyLoadedIntegration } from './lazy'; -import { shouldDisableAutoInstrumentation } from './utils/node-utils'; type GraphQLModule = { [method: string]: (...args: unknown[]) => unknown; @@ -37,11 +36,6 @@ export class GraphQL implements LazyLoadedIntegration { * @inheritDoc */ public setupOnce(_: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void { - if (shouldDisableAutoInstrumentation(getCurrentHub)) { - DEBUG_BUILD && logger.log('GraphQL Integration is skipped because of instrumenter configuration.'); - return; - } - const pkg = this.loadDependency(); if (!pkg) { diff --git a/packages/tracing-internal/src/node/integrations/mongo.ts b/packages/tracing-internal/src/node/integrations/mongo.ts index 75e03649dba2..8496ed422821 100644 --- a/packages/tracing-internal/src/node/integrations/mongo.ts +++ b/packages/tracing-internal/src/node/integrations/mongo.ts @@ -4,7 +4,6 @@ import { fill, isThenable, loadModule, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../common/debug-build'; import type { LazyLoadedIntegration } from './lazy'; -import { shouldDisableAutoInstrumentation } from './utils/node-utils'; // This allows us to use the same array for both defaults options and the type itself. // (note `as const` at the end to make it a union of string literal types (i.e. "a" | "b" | ... ) @@ -140,11 +139,6 @@ export class Mongo implements LazyLoadedIntegration { * @inheritDoc */ public setupOnce(_: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void { - if (shouldDisableAutoInstrumentation(getCurrentHub)) { - DEBUG_BUILD && logger.log('Mongo Integration is skipped because of instrumenter configuration.'); - return; - } - const pkg = this.loadDependency(); if (!pkg) { diff --git a/packages/tracing-internal/src/node/integrations/mysql.ts b/packages/tracing-internal/src/node/integrations/mysql.ts index 09d3f45932eb..d7349f804aae 100644 --- a/packages/tracing-internal/src/node/integrations/mysql.ts +++ b/packages/tracing-internal/src/node/integrations/mysql.ts @@ -4,7 +4,6 @@ import { fill, loadModule, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../common/debug-build'; import type { LazyLoadedIntegration } from './lazy'; -import { shouldDisableAutoInstrumentation } from './utils/node-utils'; interface MysqlConnection { prototype: { @@ -46,11 +45,6 @@ export class Mysql implements LazyLoadedIntegration { * @inheritDoc */ public setupOnce(_: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void { - if (shouldDisableAutoInstrumentation(getCurrentHub)) { - DEBUG_BUILD && logger.log('Mysql Integration is skipped because of instrumenter configuration.'); - return; - } - const pkg = this.loadDependency(); if (!pkg) { diff --git a/packages/tracing-internal/src/node/integrations/postgres.ts b/packages/tracing-internal/src/node/integrations/postgres.ts index 06b5eb7a76e9..9b6cb9fd77dc 100644 --- a/packages/tracing-internal/src/node/integrations/postgres.ts +++ b/packages/tracing-internal/src/node/integrations/postgres.ts @@ -4,7 +4,6 @@ import { fill, isThenable, loadModule, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../common/debug-build'; import type { LazyLoadedIntegration } from './lazy'; -import { shouldDisableAutoInstrumentation } from './utils/node-utils'; type PgClientQuery = ( config: unknown, @@ -76,11 +75,6 @@ export class Postgres implements LazyLoadedIntegration { * @inheritDoc */ public setupOnce(_: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void { - if (shouldDisableAutoInstrumentation(getCurrentHub)) { - DEBUG_BUILD && logger.log('Postgres Integration is skipped because of instrumenter configuration.'); - return; - } - const pkg = this.loadDependency(); if (!pkg) { diff --git a/packages/tracing-internal/src/node/integrations/prisma.ts b/packages/tracing-internal/src/node/integrations/prisma.ts index 2e2aa7dab17a..8f50cb18b3aa 100644 --- a/packages/tracing-internal/src/node/integrations/prisma.ts +++ b/packages/tracing-internal/src/node/integrations/prisma.ts @@ -1,9 +1,8 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getCurrentHub, startSpan } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; import type { Integration } from '@sentry/types'; import { addNonEnumerableProperty, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../common/debug-build'; -import { shouldDisableAutoInstrumentation } from './utils/node-utils'; type PrismaAction = | 'findUnique' @@ -92,11 +91,6 @@ export class Prisma implements Integration { } options.client.$use((params, next: (params: PrismaMiddlewareParams) => Promise) => { - // eslint-disable-next-line deprecation/deprecation - if (shouldDisableAutoInstrumentation(getCurrentHub)) { - return next(params); - } - const action = params.action; const model = params.model; diff --git a/packages/tracing-internal/src/node/integrations/utils/node-utils.ts b/packages/tracing-internal/src/node/integrations/utils/node-utils.ts deleted file mode 100644 index cc40f2946406..000000000000 --- a/packages/tracing-internal/src/node/integrations/utils/node-utils.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { Hub } from '@sentry/types'; - -/** - * Check if Sentry auto-instrumentation should be disabled. - * - * @param getCurrentHub A method to fetch the current hub - * @returns boolean - */ -export function shouldDisableAutoInstrumentation(getCurrentHub: () => Hub): boolean { - // eslint-disable-next-line deprecation/deprecation - const clientOptions = getCurrentHub().getClient()?.getOptions(); - const instrumenter = clientOptions?.instrumenter || 'sentry'; - - return instrumenter !== 'sentry'; -} diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 6a5f14d7b03c..57c565a86d6e 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -133,7 +133,6 @@ export type { export type { User, UserFeedback } from './user'; export type { WebFetchHeaders, WebFetchRequest } from './webfetchapi'; export type { WrappedFunction } from './wrappedfunction'; -export type { Instrumenter } from './instrumenter'; export type { HandlerDataFetch, HandlerDataXhr, diff --git a/packages/types/src/instrumenter.ts b/packages/types/src/instrumenter.ts deleted file mode 100644 index 4212d53b11f0..000000000000 --- a/packages/types/src/instrumenter.ts +++ /dev/null @@ -1 +0,0 @@ -export type Instrumenter = 'sentry' | 'otel'; diff --git a/packages/types/src/options.ts b/packages/types/src/options.ts index bcc3498a1e59..3f8c55e84949 100644 --- a/packages/types/src/options.ts +++ b/packages/types/src/options.ts @@ -1,6 +1,5 @@ import type { Breadcrumb, BreadcrumbHint } from './breadcrumb'; import type { ErrorEvent, Event, EventHint, TransactionEvent } from './event'; -import type { Instrumenter } from './instrumenter'; import type { Integration } from './integration'; import type { CaptureContext } from './scope'; import type { SdkMetadata } from './sdkmetadata'; @@ -60,15 +59,6 @@ export interface ClientOptions, Sp */ metadata: TransactionMetadata; - /** - * The instrumenter that created this transaction. - * - * @deprecated This field will be removed in v8. - */ - instrumenter: Instrumenter; - /** * Set the context of a transaction event. * @deprecated Use either `.setAttribute()`, or set the context on the scope before creating the transaction. diff --git a/packages/vercel-edge/src/sdk.ts b/packages/vercel-edge/src/sdk.ts index 5a0c00208b73..3a50156162ae 100644 --- a/packages/vercel-edge/src/sdk.ts +++ b/packages/vercel-edge/src/sdk.ts @@ -69,10 +69,6 @@ export function init(options: VercelEdgeOptions = {}): void { options.autoSessionTracking = true; } - if (options.instrumenter === undefined) { - options.instrumenter = 'sentry'; - } - const clientOptions: VercelEdgeClientOptions = { ...options, stackParser: stackParserFromStackParserOptions(options.stackParser || nodeStackParser),