Skip to content

Commit 2c09292

Browse files
authored
feat(v8): Remove deprecated integration methods on client (#11134)
Removes `getIntegrationById` and `getIntegration` methods on client. Doesn't touch anything on the hub because we want to shim those methods.
1 parent d26b25d commit 2c09292

File tree

15 files changed

+22
-60
lines changed

15 files changed

+22
-60
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ jobs:
611611
name: Playwright (${{ matrix.bundle }}${{ matrix.shard && format(' {0}/{1}', matrix.shard, matrix.shards) || ''}}) Tests
612612
needs: [job_get_metadata, job_build]
613613
if: needs.job_get_metadata.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
614-
runs-on: ubuntu-20.04
614+
runs-on: ubuntu-20.04-large-js
615615
timeout-minutes: 25
616616
strategy:
617617
fail-fast: false

MIGRATION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ Removed top-level exports: `tracingOrigins`, `MetricsAggregator`, `metricsAggreg
355355
`Sentry.configureScope`, `Span`, `spanStatusfromHttpCode`, `makeMain`, `lastEventId`, `pushScope`, `popScope`,
356356
`addGlobalEventProcessor`, `timestampWithMs`, `addExtensionMethods`
357357

358+
Remove util exports: `timestampWithMs`
359+
358360
- [Deprecation of `Hub` and `getCurrentHub()`](./MIGRATION.md#deprecate-hub)
359361
- [Removal of class-based integrations](./MIGRATION.md#removal-of-class-based-integrations)
360362
- [`tracingOrigins` option replaced with `tracePropagationTargets`](./MIGRATION.md#tracingorigins-has-been-replaced-by-tracepropagationtargets)

dev-packages/browser-integration-tests/suites/replay/canvas/manualSnapshot/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ sentryTest('can manually snapshot canvas', async ({ getLocalTestUrl, page, brows
3131
expect(incrementalSnapshots).toEqual([]);
3232

3333
await page.evaluate(() => {
34-
(window as any).Sentry.getClient().getIntegrationById('ReplayCanvas').snapshot();
34+
(window as any).Sentry.getClient().getIntegrationByName('ReplayCanvas').snapshot();
3535
});
3636

3737
const { incrementalSnapshots: incrementalSnapshotsManual } = getReplayRecordingContent(await reqPromise3);

dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ sentryTest('captures non-text response body', async ({ getLocalTestPath, page, b
254254
]);
255255
});
256256

257-
sentryTest('does not capture response body when URL does not match', async ({ getLocalTestPath, page }) => {
257+
// This test is flaky
258+
// See: https://github.com/getsentry/sentry-javascript/issues/11136
259+
sentryTest.skip('does not capture response body when URL does not match', async ({ getLocalTestPath, page }) => {
258260
if (shouldSkipReplayTest()) {
259261
sentryTest.skip();
260262
}

dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ sentryTest('captures response headers', async ({ getLocalTestPath, page }) => {
157157
]);
158158
});
159159

160-
sentryTest('does not capture response headers if URL does not match', async ({ getLocalTestPath, page }) => {
160+
// This test is flaky so it's skipped for now
161+
// See https://github.com/getsentry/sentry-javascript/issues/11139
162+
sentryTest.skip('does not capture response headers if URL does not match', async ({ getLocalTestPath, page }) => {
161163
if (shouldSkipReplayTest()) {
162164
sentryTest.skip();
163165
}

dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseSize/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ sentryTest('captures response size without Content-Length header', async ({ getL
188188
]);
189189
});
190190

191-
sentryTest('captures response size from non-text response body', async ({ getLocalTestPath, page }) => {
191+
// This test is flaky so it's skipped for now
192+
// See https://github.com/getsentry/sentry-javascript/issues/11137
193+
sentryTest.skip('captures response size from non-text response body', async ({ getLocalTestPath, page }) => {
192194
if (shouldSkipReplayTest()) {
193195
sentryTest.skip();
194196
}

dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../.
77

88
const bundle = process.env.PW_BUNDLE || '';
99

10-
sentryTest(
10+
// This test is flaky so it's skipped for now
11+
// See https://github.com/getsentry/sentry-javascript/issues/11138
12+
sentryTest.skip(
1113
'should capture metrics for LCP instrumentation handlers',
1214
async ({ browserName, getLocalTestPath, page }) => {
1315
// This uses a utility that is not exported in CDN bundles

packages/core/src/baseclient.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import type {
1515
EventProcessor,
1616
FeedbackEvent,
1717
Integration,
18-
IntegrationClass,
1918
Outcome,
2019
ParameterizedString,
2120
SdkMetadata,
@@ -317,16 +316,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
317316
}
318317
}
319318

320-
/**
321-
* Gets an installed integration by its `id`.
322-
*
323-
* @returns The installed integration or `undefined` if no integration with that `id` was installed.
324-
* @deprecated Use `getIntegrationByName()` instead.
325-
*/
326-
public getIntegrationById(integrationId: string): Integration | undefined {
327-
return this.getIntegrationByName(integrationId);
328-
}
329-
330319
/**
331320
* Gets an installed integration by its name.
332321
*
@@ -336,19 +325,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
336325
return this._integrations[integrationName] as T | undefined;
337326
}
338327

339-
/**
340-
* Returns the client's instance of the given integration class, it any.
341-
* @deprecated Use `getIntegrationByName()` instead.
342-
*/
343-
public getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null {
344-
try {
345-
return (this._integrations[integration.id] as T) || null;
346-
} catch (_oO) {
347-
DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);
348-
return null;
349-
}
350-
}
351-
352328
/**
353329
* @inheritDoc
354330
*/

packages/core/src/hub.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,7 @@ export class Hub implements HubInterface {
428428
const client = this.getClient();
429429
if (!client) return null;
430430
try {
431-
// eslint-disable-next-line deprecation/deprecation
432-
return client.getIntegration(integration);
431+
return client.getIntegrationByName<T>(integration.id) || null;
433432
} catch (_oO) {
434433
DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);
435434
return null;

packages/core/test/lib/base.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ jest.mock('@sentry/utils', () => {
4242
truncate(str: string): string {
4343
return str;
4444
},
45-
timestampWithMs(): number {
46-
return 2020;
47-
},
4845
dateTimestampInSeconds(): number {
4946
return 2020;
5047
},

packages/node/src/integrations/undici/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ export class Undici implements Integration {
170170
}
171171

172172
private _onRequestCreate = (message: unknown): void => {
173-
// eslint-disable-next-line deprecation/deprecation
174-
if (!getClient()?.getIntegration(Undici)) {
173+
if (!getClient()?.getIntegrationByName('Undici')) {
175174
return;
176175
}
177176

@@ -229,8 +228,7 @@ export class Undici implements Integration {
229228
};
230229

231230
private _onRequestEnd = (message: unknown): void => {
232-
// eslint-disable-next-line deprecation/deprecation
233-
if (!getClient()?.getIntegration(Undici)) {
231+
if (!getClient()?.getIntegrationByName('Undici')) {
234232
return;
235233
}
236234

@@ -269,8 +267,7 @@ export class Undici implements Integration {
269267
};
270268

271269
private _onRequestError = (message: unknown): void => {
272-
// eslint-disable-next-line deprecation/deprecation
273-
if (!getClient()?.getIntegration(Undici)) {
270+
if (!getClient()?.getIntegrationByName('Undici')) {
274271
return;
275272
}
276273

packages/opentelemetry/src/custom/getCurrentHub.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ export function getCurrentHub(): Hub {
6262
setContext,
6363

6464
getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null {
65-
// eslint-disable-next-line deprecation/deprecation
66-
return getClient()?.getIntegration(integration) || null;
65+
return getClient()?.getIntegrationByName<T>(integration.id) || null;
6766
},
6867

6968
startSession,

packages/sveltekit/src/server/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export {
2020
getIsolationScope,
2121
Hub,
2222
NodeClient,
23-
// eslint-disable-next-line deprecation/deprecation
24-
makeMain,
2523
setCurrentClient,
2624
Scope,
2725
SDK_VERSION,

packages/types/src/client.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { DynamicSamplingContext, Envelope } from './envelope';
77
import type { Event, EventHint } from './event';
88
import type { EventProcessor } from './eventprocessor';
99
import type { FeedbackEvent } from './feedback';
10-
import type { Integration, IntegrationClass } from './integration';
10+
import type { Integration } from './integration';
1111
import type { ClientOptions } from './options';
1212
import type { ParameterizedString } from './parameterize';
1313
import type { Scope } from './scope';
@@ -127,12 +127,6 @@ export interface Client<O extends ClientOptions = ClientOptions> {
127127
*/
128128
getEventProcessors(): EventProcessor[];
129129

130-
/**
131-
* Returns the client's instance of the given integration class, it any.
132-
* @deprecated Use `getIntegrationByName()` instead.
133-
*/
134-
getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null;
135-
136130
/** Get the instance of the integration with the given name on the client, if it was added. */
137131
getIntegrationByName<T extends Integration = Integration>(name: string): T | undefined;
138132

packages/utils/src/time.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ function createUnixTimestampInSecondsFunc(): () => number {
6868
*/
6969
export const timestampInSeconds = createUnixTimestampInSecondsFunc();
7070

71-
/**
72-
* Re-exported with an old name for backwards-compatibility.
73-
* TODO (v8): Remove this
74-
*
75-
* @deprecated Use `timestampInSeconds` instead.
76-
*/
77-
export const timestampWithMs = timestampInSeconds;
78-
7971
/**
8072
* Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.
8173
*/

0 commit comments

Comments
 (0)