diff --git a/packages/core/src/utils/parseSampleRate.ts b/packages/core/src/utils/parseSampleRate.ts index 96bb8c98dec2..fdf12371eff6 100644 --- a/packages/core/src/utils/parseSampleRate.ts +++ b/packages/core/src/utils/parseSampleRate.ts @@ -14,7 +14,7 @@ export function parseSampleRate(sampleRate: unknown): number | undefined { } const rate = typeof sampleRate === 'string' ? parseFloat(sampleRate) : sampleRate; - if (typeof rate !== 'number' || isNaN(rate)) { + if (typeof rate !== 'number' || isNaN(rate) || rate < 0 || rate > 1) { DEBUG_BUILD && logger.warn( `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify( @@ -24,11 +24,5 @@ export function parseSampleRate(sampleRate: unknown): number | undefined { return undefined; } - if (rate < 0 || rate > 1) { - DEBUG_BUILD && - logger.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${rate}.`); - return undefined; - } - return rate; }