Skip to content
Merged
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
6 changes: 5 additions & 1 deletion packages/browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
10 changes: 8 additions & 2 deletions packages/browser/src/profiling/integration.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -18,7 +18,7 @@ import {

const INTEGRATION_NAME = 'BrowserProfiling';

const browserProfilingIntegration = (() => {
const _browserProfilingIntegration = (() => {
return {
name: INTEGRATION_NAME,
// TODO v8: Remove this
Expand Down Expand Up @@ -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
Expand All @@ -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<Integration & { setup: (client: Client) => void }>;

// eslint-disable-next-line deprecation/deprecation
export type BrowserProfilingIntegration = typeof BrowserProfilingIntegration;
3 changes: 1 addition & 2 deletions packages/browser/test/unit/profiling/integration.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -44,7 +43,7 @@ describe('BrowserProfilingIntegration', () => {
send,
};
},
integrations: [new Sentry.BrowserTracing(), new BrowserProfilingIntegration()],
integrations: [Sentry.browserTracingIntegration(), Sentry.browserProfilingIntegration()],
});

const client = Sentry.getClient<BrowserClient>();
Expand Down