Skip to content

Commit f405061

Browse files
committed
s/defaultRoutingInstrumentation/instrumentRoutingWithDefaults
1 parent 16eee80 commit f405061

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

packages/tracing/src/browser/browsertracing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
instrumentOutgoingRequests,
1414
RequestInstrumentationOptions,
1515
} from './request';
16-
import { defaultRoutingInstrumentation } from './router';
16+
import { instrumentRoutingWithDefaults } from './router';
1717

1818
export const DEFAULT_MAX_TRANSACTION_DURATION_SECONDS = 600;
1919

@@ -87,7 +87,7 @@ const DEFAULT_BROWSER_TRACING_OPTIONS = {
8787
idleTimeout: DEFAULT_IDLE_TIMEOUT,
8888
markBackgroundTransactions: true,
8989
maxTransactionDuration: DEFAULT_MAX_TRANSACTION_DURATION_SECONDS,
90-
routingInstrumentation: defaultRoutingInstrumentation,
90+
routingInstrumentation: instrumentRoutingWithDefaults,
9191
startTransactionOnLocationChange: true,
9292
startTransactionOnPageLoad: true,
9393
...defaultRequestInstrumentationOptions,

packages/tracing/src/browser/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const global = getGlobalObject<Window>();
66
/**
77
* Default function implementing pageload and navigation transactions
88
*/
9-
export function defaultRoutingInstrumentation<T extends Transaction>(
9+
export function instrumentRoutingWithDefaults<T extends Transaction>(
1010
customStartTransaction: (context: TransactionContext) => T | undefined,
1111
startTransactionOnPageLoad: boolean = true,
1212
startTransactionOnLocationChange: boolean = true,

packages/tracing/test/browser/browsertracing.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
getMetaContent,
1313
} from '../../src/browser/browsertracing';
1414
import { defaultRequestInstrumentationOptions } from '../../src/browser/request';
15-
import { defaultRoutingInstrumentation } from '../../src/browser/router';
15+
import { instrumentRoutingWithDefaults } from '../../src/browser/router';
1616
import * as hubExtensions from '../../src/hubextensions';
1717
import { DEFAULT_IDLE_TIMEOUT, IdleTransaction } from '../../src/idletransaction';
1818
import { getActiveTransaction, secToMs } from '../../src/utils';
@@ -83,7 +83,7 @@ describe('BrowserTracing', () => {
8383
idleTimeout: DEFAULT_IDLE_TIMEOUT,
8484
markBackgroundTransactions: true,
8585
maxTransactionDuration: DEFAULT_MAX_TRANSACTION_DURATION_SECONDS,
86-
routingInstrumentation: defaultRoutingInstrumentation,
86+
routingInstrumentation: instrumentRoutingWithDefaults,
8787
startTransactionOnLocationChange: true,
8888
startTransactionOnPageLoad: true,
8989
...defaultRequestInstrumentationOptions,

packages/tracing/test/browser/router.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { JSDOM } from 'jsdom';
22

3-
import { defaultRoutingInstrumentation } from '../../src/browser/router';
3+
import { instrumentRoutingWithDefaults } from '../../src/browser/router';
44

55
let mockChangeHistory: ({ to, from }: { to: string; from?: string }) => void = () => undefined;
66
let addInstrumentationHandlerType: string = '';
@@ -15,7 +15,7 @@ jest.mock('@sentry/utils', () => {
1515
};
1616
});
1717

18-
describe('defaultRoutingInstrumentation', () => {
18+
describe('instrumentRoutingWithDefaults', () => {
1919
const mockFinish = jest.fn();
2020
const customStartTransaction = jest.fn().mockReturnValue({ finish: mockFinish });
2121
beforeEach(() => {
@@ -34,18 +34,18 @@ describe('defaultRoutingInstrumentation', () => {
3434
it('does not start transactions if global location is undefined', () => {
3535
// @ts-ignore need to override global document
3636
global.location = undefined;
37-
defaultRoutingInstrumentation(customStartTransaction);
37+
instrumentRoutingWithDefaults(customStartTransaction);
3838
expect(customStartTransaction).toHaveBeenCalledTimes(0);
3939
});
4040

4141
it('starts a pageload transaction', () => {
42-
defaultRoutingInstrumentation(customStartTransaction);
42+
instrumentRoutingWithDefaults(customStartTransaction);
4343
expect(customStartTransaction).toHaveBeenCalledTimes(1);
4444
expect(customStartTransaction).toHaveBeenLastCalledWith({ name: 'blank', op: 'pageload' });
4545
});
4646

4747
it('does not start a pageload transaction if startTransactionOnPageLoad is false', () => {
48-
defaultRoutingInstrumentation(customStartTransaction, false);
48+
instrumentRoutingWithDefaults(customStartTransaction, false);
4949
expect(customStartTransaction).toHaveBeenCalledTimes(0);
5050
});
5151

@@ -56,12 +56,12 @@ describe('defaultRoutingInstrumentation', () => {
5656
});
5757

5858
it('it is not created automatically', () => {
59-
defaultRoutingInstrumentation(customStartTransaction);
59+
instrumentRoutingWithDefaults(customStartTransaction);
6060
expect(customStartTransaction).not.toHaveBeenLastCalledWith({ name: 'blank', op: 'navigation' });
6161
});
6262

6363
it('is created on location change', () => {
64-
defaultRoutingInstrumentation(customStartTransaction);
64+
instrumentRoutingWithDefaults(customStartTransaction);
6565
mockChangeHistory({ to: 'here', from: 'there' });
6666
expect(addInstrumentationHandlerType).toBe('history');
6767

@@ -70,23 +70,23 @@ describe('defaultRoutingInstrumentation', () => {
7070
});
7171

7272
it('is not created if startTransactionOnLocationChange is false', () => {
73-
defaultRoutingInstrumentation(customStartTransaction, true, false);
73+
instrumentRoutingWithDefaults(customStartTransaction, true, false);
7474
mockChangeHistory({ to: 'here', from: 'there' });
7575
expect(addInstrumentationHandlerType).toBe('');
7676

7777
expect(customStartTransaction).toHaveBeenCalledTimes(1);
7878
});
7979

8080
it('finishes the last active transaction', () => {
81-
defaultRoutingInstrumentation(customStartTransaction);
81+
instrumentRoutingWithDefaults(customStartTransaction);
8282

8383
expect(mockFinish).toHaveBeenCalledTimes(0);
8484
mockChangeHistory({ to: 'here', from: 'there' });
8585
expect(mockFinish).toHaveBeenCalledTimes(1);
8686
});
8787

8888
it('will finish active transaction multiple times', () => {
89-
defaultRoutingInstrumentation(customStartTransaction);
89+
instrumentRoutingWithDefaults(customStartTransaction);
9090

9191
expect(mockFinish).toHaveBeenCalledTimes(0);
9292
mockChangeHistory({ to: 'here', from: 'there' });
@@ -98,7 +98,7 @@ describe('defaultRoutingInstrumentation', () => {
9898
});
9999

100100
it('not created if `from` is equal to `to`', () => {
101-
defaultRoutingInstrumentation(customStartTransaction);
101+
instrumentRoutingWithDefaults(customStartTransaction);
102102
mockChangeHistory({ to: 'first/path', from: 'first/path' });
103103
expect(addInstrumentationHandlerType).toBe('history');
104104

0 commit comments

Comments
 (0)