diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx index 573a123e..166d468a 100644 --- a/src/lib/statsig/statsig.tsx +++ b/src/lib/statsig/statsig.tsx @@ -102,16 +102,19 @@ export function logEvent( rawMetadata: LogEvents[E] & FlatJSONRecord, ) { try { + if ( + process.env.NODE_ENV === 'development' && + eventName.endsWith(':sampled') && + !DOWNSAMPLED_EVENTS.has(eventName) + ) { + logger.error( + 'Did you forget to add ' + eventName + ' to DOWNSAMPLED_EVENTS?', + ) + } + if (isDownsampledSession && DOWNSAMPLED_EVENTS.has(eventName)) { return } - if (process.env.NODE_ENV === 'development') { - if (eventName.endsWith(':sampled')) { - logger.error( - 'Did you forget to add ' + eventName + ' to DOWNSAMPLED_EVENTS?', - ) - } - } const fullMetadata = { ...rawMetadata, } as Record // Statsig typings are unnecessarily strict here.