Skip to content

Commit ce56427

Browse files
Merge remote-tracking branch 'origin/kw-export-ip-address-helpers' into kw-export-ip-address-helpers
2 parents 3115cc4 + de769e7 commit ce56427

File tree

38 files changed

+61
-207
lines changed

38 files changed

+61
-207
lines changed

dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/app/entry.server.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ installGlobals();
1313

1414
const ABORT_DELAY = 5_000;
1515

16-
export const handleError = Sentry.wrapRemixHandleError;
16+
export const handleError = Sentry.sentryHandleError;
1717

1818
export default function handleRequest(
1919
request: Request,

dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/app/entry.server.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ installGlobals();
1313

1414
const ABORT_DELAY = 5_000;
1515

16-
export const handleError = Sentry.wrapRemixHandleError;
16+
export const handleError = Sentry.sentryHandleError;
1717

1818
export default function handleRequest(
1919
request: Request,

dev-packages/e2e-tests/test-applications/create-remix-app-express/app/entry.server.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ installGlobals();
1313

1414
const ABORT_DELAY = 5_000;
1515

16-
export const handleError = Sentry.wrapRemixHandleError;
16+
export const handleError = Sentry.sentryHandleError;
1717

1818
export default function handleRequest(
1919
request: Request,

docs/migration/v8-to-v9.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ The following outlines deprecations that were introduced in version 8 of the SDK
326326

327327
- **Passing `undefined` to `tracesSampleRate` / `tracesSampler` / `enableTracing` will be handled differently in v9**
328328

329-
In v8, explicitly setting `tracesSampleRate` (even if it is set to `undefined`) will result in tracing being _enabled_, although no spans will be generated.
329+
In v8, explicitly setting `tracesSampleRate` (even if it is set to `undefined`) resulted in tracing being _enabled_, although no spans were generated.
330330

331331
```ts
332332
Sentry.init({
@@ -338,6 +338,8 @@ In v9, we will streamline this behavior so that passing `undefined` will result
338338

339339
If you are relying on `undefined` being passed in and having tracing enabled because of this, you should update your config to set e.g. `tracesSampleRate: 0` instead, which will also enable tracing in v9.
340340

341+
The `enableTracing` option was removed. In v9, to emulate `enableTracing: true`, set `tracesSampleRate: 1`. To emulate `enableTracing: false`, remove the `tracesSampleRate` and `tracesSampler` options (if configured).
342+
341343
- **The `autoSessionTracking` option is deprecated.**
342344

343345
To enable session tracking, it is recommended to unset `autoSessionTracking` and ensure that either, in browser environments the `browserSessionIntegration` is added, or in server environments the `httpIntegration` is added.

packages/astro/test/client/sdk.test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ describe('Sentry client SDK', () => {
5252
it.each([
5353
['tracesSampleRate', { tracesSampleRate: 0 }],
5454
['tracesSampler', { tracesSampler: () => 1.0 }],
55-
['enableTracing', { enableTracing: true }],
5655
['no tracing option set', {}],
5756
])('adds browserTracingIntegration if tracing is enabled via %s', (_, tracingOptions) => {
5857
init({
@@ -72,7 +71,7 @@ describe('Sentry client SDK', () => {
7271

7372
init({
7473
dsn: 'https://[email protected]/1337',
75-
enableTracing: true,
74+
tracesSampleRate: 1,
7675
});
7776

7877
const integrationsToInit = browserInit.mock.calls[0]![0]?.defaultIntegrations || [];
@@ -90,7 +89,7 @@ describe('Sentry client SDK', () => {
9089
integrations: [
9190
browserTracingIntegration({ finalTimeout: 10, instrumentNavigation: false, instrumentPageLoad: false }),
9291
],
93-
enableTracing: true,
92+
tracesSampleRate: 1,
9493
});
9594

9695
const browserTracing = getClient<BrowserClient>()?.getIntegrationByName('BrowserTracing');

packages/browser-utils/src/metrics/web-vitals/types/base.ts

-9
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,6 @@ export type MetricWithAttribution =
104104
*/
105105
export type MetricRatingThresholds = [number, number];
106106

107-
/**
108-
* @deprecated Use metric-specific function types instead, such as:
109-
* `(metric: LCPMetric) => void`. If a single callback type is needed for
110-
* multiple metrics, use `(metric: MetricType) => void`.
111-
*/
112-
export interface ReportCallback {
113-
(metric: MetricType): void;
114-
}
115-
116107
export interface ReportOpts {
117108
reportAllChanges?: boolean;
118109
durationThreshold?: number;

packages/browser/src/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ export {
3939
} from './tracing/browserTracingIntegration';
4040
export type { RequestInstrumentationOptions } from './tracing/request';
4141
export {
42-
// eslint-disable-next-line deprecation/deprecation
43-
addTracingExtensions,
4442
registerSpanErrorInstrumentation,
4543
getActiveSpan,
4644
getRootSpan,

packages/cloudflare/test/integrations/fetch.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe('WinterCGFetch instrumentation', () => {
2626

2727
client = new FakeClient({
2828
dsn: 'https://[email protected]/1337',
29-
enableTracing: true,
3029
tracesSampleRate: 1,
3130
integrations: [],
3231
transport: () => ({

packages/core/src/client.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1111,11 +1111,13 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
11111111
/**
11121112
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
11131113
*/
1114+
// TODO(v10): Remove
11141115
export type BaseClient = Client;
11151116

11161117
/**
11171118
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
11181119
*/
1120+
// TODO(v10): Remove
11191121
export const BaseClient = Client;
11201122

11211123
/**

packages/core/src/fetch.ts

-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { Client } from './client';
2-
import type { Scope } from './scope';
31
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes';
42
import { SPAN_STATUS_ERROR, setHttpStatus, startInactiveSpan } from './tracing';
53
import { SentryNonRecordingSpan } from './tracing/sentryNonRecordingSpan';
@@ -201,27 +199,6 @@ function _addTracingHeadersToFetchRequest(
201199
}
202200
}
203201

204-
/**
205-
* Adds sentry-trace and baggage headers to the various forms of fetch headers.
206-
*
207-
* @deprecated This function will not be exported anymore in v9.
208-
*/
209-
export function addTracingHeadersToFetchRequest(
210-
request: string | unknown,
211-
_client: Client | undefined,
212-
_scope: Scope | undefined,
213-
fetchOptionsObj: {
214-
headers?:
215-
| {
216-
[key: string]: string[] | string | undefined;
217-
}
218-
| PolymorphicRequestHeaders;
219-
},
220-
span?: Span,
221-
): PolymorphicRequestHeaders | undefined {
222-
return _addTracingHeadersToFetchRequest(request as Request, fetchOptionsObj, span);
223-
}
224-
225202
function getFullURL(url: string): string | undefined {
226203
try {
227204
const parsed = new URL(url);

packages/core/src/index.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,7 @@ export { rewriteFramesIntegration } from './integrations/rewriteframes';
110110
export { zodErrorsIntegration } from './integrations/zoderrors';
111111
export { thirdPartyErrorFilterIntegration } from './integrations/third-party-errors-filter';
112112
export { profiler } from './profiling';
113-
export {
114-
// eslint-disable-next-line deprecation/deprecation
115-
addTracingHeadersToFetchRequest,
116-
instrumentFetchRequest,
117-
} from './fetch';
113+
export { instrumentFetchRequest } from './fetch';
118114
export { trpcMiddleware } from './trpc';
119115
export { captureFeedback } from './feedback';
120116
export type { ReportDialogOptions } from './report-dialog';

packages/core/src/tracing/hubextensions.ts

-8
This file was deleted.

packages/core/src/tracing/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export { registerSpanErrorInstrumentation } from './errors';
22
export { setCapturedScopesOnSpan, getCapturedScopesOnSpan } from './utils';
3-
// eslint-disable-next-line deprecation/deprecation
4-
export { addTracingExtensions } from './hubextensions';
53
export { startIdleSpan, TRACING_DEFAULTS } from './idleSpan';
64
export { SentrySpan } from './sentrySpan';
75
export { SentryNonRecordingSpan } from './sentryNonRecordingSpan';

packages/core/src/tracing/sampling.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { parseSampleRate } from '../utils/parseSampleRate';
1212
* sent to Sentry.
1313
*/
1414
export function sampleSpan(
15-
options: Pick<Options, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'>,
15+
options: Pick<Options, 'tracesSampleRate' | 'tracesSampler'>,
1616
samplingContext: SamplingContext,
1717
sampleRand: number,
1818
): [sampled: boolean, sampleRate?: number] {
@@ -21,7 +21,7 @@ export function sampleSpan(
2121
return [false];
2222
}
2323

24-
// we would have bailed already if neither `tracesSampler` nor `tracesSampleRate` nor `enableTracing` were defined, so one of these should
24+
// we would have bailed already if neither `tracesSampler` nor `tracesSampleRate` were defined, so one of these should
2525
// work; prefer the hook if so
2626
let sampleRate;
2727
if (typeof options.tracesSampler === 'function') {
@@ -30,9 +30,6 @@ export function sampleSpan(
3030
sampleRate = samplingContext.parentSampled;
3131
} else if (typeof options.tracesSampleRate !== 'undefined') {
3232
sampleRate = options.tracesSampleRate;
33-
} else {
34-
// When `enableTracing === true`, we use a sample rate of 100%
35-
sampleRate = 1;
3633
}
3734

3835
// Since this is coming from the user (or from a function provided by the user), who knows what we might get.

packages/core/src/types-hoist/options.ts

-11
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,6 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
8181
*/
8282
tracesSampleRate?: number;
8383

84-
/**
85-
* If this is enabled, spans and trace data will be generated and captured.
86-
* This will set the `tracesSampleRate` to the recommended default of `1.0` if `tracesSampleRate` is undefined.
87-
* Note that `tracesSampleRate` and `tracesSampler` take precedence over this option.
88-
*
89-
* @deprecated This option is deprecated and will be removed in the next major version. If you want to enable performance
90-
* monitoring, please use the `tracesSampleRate` or `tracesSampler` options instead. If you wan't to disable performance
91-
* monitoring, remove the `tracesSampler` and `tracesSampleRate` options.
92-
*/
93-
enableTracing?: boolean;
94-
9584
/**
9685
* If this is enabled, any spans started will always have their parent be the active root span,
9786
* if there is any active span.

packages/core/src/utils-hoist/index.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ export {
4747
parseSemver,
4848
uuid4,
4949
} from './misc';
50-
// eslint-disable-next-line deprecation/deprecation
51-
export { dynamicRequire, isNodeEnv, loadModule } from './node';
50+
export { isNodeEnv, loadModule } from './node';
5251
export { normalize, normalizeToSize, normalizeUrlToBase } from './normalize';
5352
export {
5453
addNonEnumerableProperty,
@@ -136,8 +135,6 @@ export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStack
136135
export { callFrameToStackFrame, watchdogTimer } from './anr';
137136
export { LRUMap } from './lru';
138137
export {
139-
// eslint-disable-next-line deprecation/deprecation
140-
generatePropagationContext,
141138
generateTraceId,
142139
generateSpanId,
143140
} from './propagationContext';

packages/core/src/utils-hoist/node.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ export function isNodeEnv(): boolean {
2323
* Requires a module which is protected against bundler minification.
2424
*
2525
* @param request The module path to resolve
26-
* @deprecated This function will be removed in the next major version.
2726
*/
2827
// eslint-disable-next-line @typescript-eslint/no-explicit-any
29-
export function dynamicRequire(mod: any, request: string): any {
28+
function dynamicRequire(mod: any, request: string): any {
3029
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
3130
return mod.require(request);
3231
}
@@ -48,17 +47,14 @@ export function loadModule<T>(moduleName: string): T | undefined {
4847
let mod: T | undefined;
4948

5049
try {
51-
// eslint-disable-next-line deprecation/deprecation
5250
mod = dynamicRequire(module, moduleName);
5351
} catch (e) {
5452
// no-empty
5553
}
5654

5755
if (!mod) {
5856
try {
59-
// eslint-disable-next-line deprecation/deprecation
6057
const { cwd } = dynamicRequire(module, 'process');
61-
// eslint-disable-next-line deprecation/deprecation
6258
mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) as T;
6359
} catch (e) {
6460
// no-empty

packages/core/src/utils-hoist/propagationContext.ts

-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
import type { PropagationContext } from '../types-hoist';
21
import { uuid4 } from './misc';
32

4-
/**
5-
* Returns a new minimal propagation context.
6-
*
7-
* @deprecated Use `generateTraceId` and `generateSpanId` instead.
8-
*/
9-
export function generatePropagationContext(): PropagationContext {
10-
return {
11-
traceId: generateTraceId(),
12-
sampleRand: Math.random(),
13-
};
14-
}
15-
163
/**
174
* Generate a random, valid trace ID.
185
*/

packages/core/src/utils/hasTracingEnabled.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ declare const __SENTRY_TRACING__: boolean | undefined;
1010
* Tracing is enabled when at least one of `tracesSampleRate` and `tracesSampler` is defined in the SDK config.
1111
*/
1212
export function hasTracingEnabled(
13-
maybeOptions?: Pick<Options, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'> | undefined,
13+
maybeOptions?: Pick<Options, 'tracesSampleRate' | 'tracesSampler'> | undefined,
1414
): boolean {
1515
if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) {
1616
return false;
1717
}
1818

1919
const client = getClient();
2020
const options = maybeOptions || client?.getOptions();
21-
// eslint-disable-next-line deprecation/deprecation
22-
return !!options && (options.enableTracing || options.tracesSampleRate != null || !!options.tracesSampler);
21+
return (
22+
!!options &&
23+
// Note: This check is `!= null`, meaning "nullish"
24+
(options.tracesSampleRate != null || !!options.tracesSampler)
25+
);
2326
}

packages/core/test/lib/feedback.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ describe('captureFeedback', () => {
314314
getDefaultTestClientOptions({
315315
dsn: 'https://[email protected]/1',
316316
enableSend: true,
317-
enableTracing: true,
317+
tracesSampleRate: 1,
318318
// We don't care about transactions here...
319319
beforeSendTransaction() {
320320
return null;
@@ -385,7 +385,7 @@ describe('captureFeedback', () => {
385385
getDefaultTestClientOptions({
386386
dsn: 'https://[email protected]/1',
387387
enableSend: true,
388-
enableTracing: true,
388+
tracesSampleRate: 1,
389389
// We don't care about transactions here...
390390
beforeSendTransaction() {
391391
return null;

packages/core/test/lib/tracing/errors.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('registerErrorHandlers()', () => {
2424
beforeEach(() => {
2525
mockAddGlobalErrorInstrumentationHandler.mockClear();
2626
mockAddGlobalUnhandledRejectionInstrumentationHandler.mockClear();
27-
const options = getDefaultTestClientOptions({ enableTracing: true });
27+
const options = getDefaultTestClientOptions({ tracesSampleRate: 1 });
2828
const client = new TestClient(options);
2929
setCurrentClient(client);
3030
client.init();

packages/core/test/lib/tracing/trace.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,7 @@ describe('withActiveSpan()', () => {
16841684

16851685
setAsyncContextStrategy(undefined);
16861686

1687-
const options = getDefaultTestClientOptions({ enableTracing: true });
1687+
const options = getDefaultTestClientOptions({ tracesSampleRate: 1 });
16881688
const client = new TestClient(options);
16891689
setCurrentClient(client);
16901690
client.init();

packages/core/test/lib/utils/hasTracingEnabled.test.ts

+1-16
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,13 @@ describe('hasTracingEnabled', () => {
55
const tracesSampleRate = 1;
66
it.each([
77
['No options', undefined, false],
8-
['No tracesSampler or tracesSampleRate or enableTracing', {}, false],
8+
['No tracesSampler or tracesSampleRate', {}, false],
99
['With tracesSampler', { tracesSampler }, true],
1010
['With tracesSampleRate', { tracesSampleRate }, true],
11-
['With enableTracing=true', { enableTracing: true }, true],
12-
['With enableTracing=false', { enableTracing: false }, false],
13-
['With enableTracing=undefined', { enableTracing: undefined }, false],
1411
['With tracesSampleRate=undefined', { tracesSampleRate: undefined }, false],
1512
['With tracesSampleRate=0', { tracesSampleRate: 0 }, true],
1613
['With tracesSampler=undefined', { tracesSampler: undefined }, false],
17-
['With tracesSampler && enableTracing=false', { tracesSampler, enableTracing: false }, true],
18-
['With tracesSampleRate && enableTracing=false', { tracesSampler, enableTracing: false }, true],
1914
['With tracesSampler and tracesSampleRate', { tracesSampler, tracesSampleRate }, true],
20-
[
21-
'With tracesSampler and tracesSampleRate and enableTracing=true',
22-
{ tracesSampler, tracesSampleRate, enableTracing: true },
23-
true,
24-
],
25-
[
26-
'With tracesSampler and tracesSampleRate and enableTracing=false',
27-
{ tracesSampler, tracesSampleRate, enableTracing: false },
28-
true,
29-
],
3015
])(
3116
'%s',
3217
(_: string, input: Parameters<typeof hasTracingEnabled>[0], output: ReturnType<typeof hasTracingEnabled>) => {

0 commit comments

Comments
 (0)