Skip to content

Commit 8af2248

Browse files
committed
rename it
1 parent 41db465 commit 8af2248

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

packages/node/src/sdk/initOtel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export function setupOtel(client: NodeClient): BasicTracerProvider {
142142
forceFlushTimeoutMillis: 500,
143143
spanProcessors: [
144144
new SentrySpanProcessor({
145-
timeout: _getSpanProcessorTimeout(client.getOptions().maxSpanWaitDuration),
145+
timeout: _clampSpanProcessorTimeout(client.getOptions().maxSpanWaitDuration),
146146
}),
147147
],
148148
});
@@ -157,7 +157,7 @@ export function setupOtel(client: NodeClient): BasicTracerProvider {
157157
}
158158

159159
/** Just exported for tests. */
160-
export function _getSpanProcessorTimeout(maxSpanWaitDuration: number | undefined): number | undefined {
160+
export function _clampSpanProcessorTimeout(maxSpanWaitDuration: number | undefined): number | undefined {
161161
if (maxSpanWaitDuration == null) {
162162
return undefined;
163163
}

packages/node/test/sdk/initOtel.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
import { logger } from '@sentry/core';
2-
import { _getSpanProcessorTimeout } from '../../src/sdk/initOtel';
2+
import { _clampSpanProcessorTimeout } from '../../src/sdk/initOtel';
33

4-
describe('_getSpanProcessorTimeout', () => {
4+
describe('_clampSpanProcessorTimeout', () => {
55
beforeEach(() => {
66
jest.clearAllMocks();
77
});
88

99
it('works with undefined', () => {
1010
const loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
11-
const timeout = _getSpanProcessorTimeout(undefined);
11+
const timeout = _clampSpanProcessorTimeout(undefined);
1212
expect(timeout).toBe(undefined);
1313
expect(loggerWarnSpy).not.toHaveBeenCalled();
1414
});
1515

1616
it('works with positive number', () => {
1717
const loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
18-
const timeout = _getSpanProcessorTimeout(10);
18+
const timeout = _clampSpanProcessorTimeout(10);
1919
expect(timeout).toBe(10);
2020
expect(loggerWarnSpy).not.toHaveBeenCalled();
2121
});
2222

2323
it('works with 0', () => {
2424
const loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
25-
const timeout = _getSpanProcessorTimeout(0);
25+
const timeout = _clampSpanProcessorTimeout(0);
2626
expect(timeout).toBe(undefined);
2727
expect(loggerWarnSpy).toHaveBeenCalledTimes(1);
2828
expect(loggerWarnSpy).toHaveBeenCalledWith(
@@ -32,7 +32,7 @@ describe('_getSpanProcessorTimeout', () => {
3232

3333
it('works with negative number', () => {
3434
const loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
35-
const timeout = _getSpanProcessorTimeout(-10);
35+
const timeout = _clampSpanProcessorTimeout(-10);
3636
expect(timeout).toBe(undefined);
3737
expect(loggerWarnSpy).toHaveBeenCalledTimes(1);
3838
expect(loggerWarnSpy).toHaveBeenCalledWith(
@@ -42,7 +42,7 @@ describe('_getSpanProcessorTimeout', () => {
4242

4343
it('works with -Infinity', () => {
4444
const loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
45-
const timeout = _getSpanProcessorTimeout(-Infinity);
45+
const timeout = _clampSpanProcessorTimeout(-Infinity);
4646
expect(timeout).toBe(undefined);
4747
expect(loggerWarnSpy).toHaveBeenCalledTimes(1);
4848
expect(loggerWarnSpy).toHaveBeenCalledWith(
@@ -52,23 +52,23 @@ describe('_getSpanProcessorTimeout', () => {
5252

5353
it('works with Infinity', () => {
5454
const loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
55-
const timeout = _getSpanProcessorTimeout(Infinity);
55+
const timeout = _clampSpanProcessorTimeout(Infinity);
5656
expect(timeout).toBe(1_000_000);
5757
expect(loggerWarnSpy).toHaveBeenCalledTimes(1);
5858
expect(loggerWarnSpy).toHaveBeenCalledWith('`maxSpanWaitDuration` is too high, using the maximum value of 1000000');
5959
});
6060

6161
it('works with large number', () => {
6262
const loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
63-
const timeout = _getSpanProcessorTimeout(1_000_000_000);
63+
const timeout = _clampSpanProcessorTimeout(1_000_000_000);
6464
expect(timeout).toBe(1_000_000);
6565
expect(loggerWarnSpy).toHaveBeenCalledTimes(1);
6666
expect(loggerWarnSpy).toHaveBeenCalledWith('`maxSpanWaitDuration` is too high, using the maximum value of 1000000');
6767
});
6868

6969
it('works with NaN', () => {
7070
const loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => {});
71-
const timeout = _getSpanProcessorTimeout(NaN);
71+
const timeout = _clampSpanProcessorTimeout(NaN);
7272
expect(timeout).toBe(undefined);
7373
expect(loggerWarnSpy).toHaveBeenCalledTimes(1);
7474
expect(loggerWarnSpy).toHaveBeenCalledWith(

0 commit comments

Comments
 (0)