MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / _clampSpanProcessorTimeout

Function _clampSpanProcessorTimeout

packages/node/src/sdk/initOtel.ts:115–132  ·  view source on GitHub ↗
(maxSpanWaitDuration: number | undefined)

Source from the content-addressed store, hash-verified

113
114/** Just exported for tests. */
115export function _clampSpanProcessorTimeout(maxSpanWaitDuration: number | undefined): number | undefined {
116 if (maxSpanWaitDuration == null) {
117 return undefined;
118 }
119
120 // We guard for a max. value here, because we create an array with this length
121 // So if this value is too large, this would fail
122 if (maxSpanWaitDuration > MAX_MAX_SPAN_WAIT_DURATION) {
123 DEBUG_BUILD &&
124 coreDebug.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${MAX_MAX_SPAN_WAIT_DURATION}`);
125 return MAX_MAX_SPAN_WAIT_DURATION;
126 } else if (maxSpanWaitDuration <= 0 || Number.isNaN(maxSpanWaitDuration)) {
127 DEBUG_BUILD && coreDebug.warn('`maxSpanWaitDuration` must be a positive number, using default value instead.');
128 return undefined;
129 }
130
131 return maxSpanWaitDuration;
132}

Callers 2

initOtel.test.tsFile · 0.90
setupOtelFunction · 0.85

Calls 1

warnMethod · 0.65

Tested by

no test coverage detected