diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index 408a64081a02..cda5f65a800e 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -83,4 +83,8 @@ export type { SpanStatusType } from '@sentry/core'; export type { Span } from '@sentry/types'; export { makeBrowserOfflineTransport } from './transports/offline'; export { onProfilingStartRouteTransaction } from './profiling/hubextensions'; -export { BrowserProfilingIntegration } from './profiling/integration'; +export { + // eslint-disable-next-line deprecation/deprecation + BrowserProfilingIntegration, + browserProfilingIntegration, +} from './profiling/integration'; diff --git a/packages/browser/src/profiling/integration.ts b/packages/browser/src/profiling/integration.ts index a3af7744c4e4..bf8e56a626b5 100644 --- a/packages/browser/src/profiling/integration.ts +++ b/packages/browser/src/profiling/integration.ts @@ -1,4 +1,4 @@ -import { convertIntegrationFnToClass, getCurrentScope } from '@sentry/core'; +import { convertIntegrationFnToClass, defineIntegration, getCurrentScope } from '@sentry/core'; import type { Client, EventEnvelope, Integration, IntegrationClass, IntegrationFn, Transaction } from '@sentry/types'; import type { Profile } from '@sentry/types/src/profiling'; import { logger } from '@sentry/utils'; @@ -18,7 +18,7 @@ import { const INTEGRATION_NAME = 'BrowserProfiling'; -const browserProfilingIntegration = (() => { +const _browserProfilingIntegration = (() => { return { name: INTEGRATION_NAME, // TODO v8: Remove this @@ -102,6 +102,8 @@ const browserProfilingIntegration = (() => { }; }) satisfies IntegrationFn; +export const browserProfilingIntegration = defineIntegration(_browserProfilingIntegration); + /** * Browser profiling integration. Stores any event that has contexts["profile"]["profile_id"] * This exists because we do not want to await async profiler.stop calls as transaction.finish is called @@ -110,9 +112,13 @@ const browserProfilingIntegration = (() => { * integration less reliable as we might be dropping profiles when the cache is full. * * @experimental + * @deprecated Use `browserProfilingIntegration()` instead. */ // eslint-disable-next-line deprecation/deprecation export const BrowserProfilingIntegration = convertIntegrationFnToClass( INTEGRATION_NAME, browserProfilingIntegration, ) as IntegrationClass void }>; + +// eslint-disable-next-line deprecation/deprecation +export type BrowserProfilingIntegration = typeof BrowserProfilingIntegration; diff --git a/packages/browser/test/unit/profiling/integration.test.ts b/packages/browser/test/unit/profiling/integration.test.ts index b69d3a52d655..9394221b0e4b 100644 --- a/packages/browser/test/unit/profiling/integration.test.ts +++ b/packages/browser/test/unit/profiling/integration.test.ts @@ -1,7 +1,6 @@ import type { BrowserClient } from '@sentry/browser'; import * as Sentry from '@sentry/browser'; -import { BrowserProfilingIntegration } from '../../../src/profiling/integration'; import type { JSSelfProfile } from '../../../src/profiling/jsSelfProfiling'; describe('BrowserProfilingIntegration', () => { @@ -44,7 +43,7 @@ describe('BrowserProfilingIntegration', () => { send, }; }, - integrations: [new Sentry.BrowserTracing(), new BrowserProfilingIntegration()], + integrations: [Sentry.browserTracingIntegration(), Sentry.browserProfilingIntegration()], }); const client = Sentry.getClient();