@@ -16,6 +16,9 @@ import io.sentry.SentryEnvelope
1616import io.sentry.SentryEnvelopeHeader
1717import io.sentry.SentryEnvelopeItem
1818import io.sentry.SentryEvent
19+ import io.sentry.SentryLogEvent
20+ import io.sentry.SentryLogEvents
21+ import io.sentry.SentryLongDate
1922import io.sentry.SentryOptions
2023import io.sentry.SentryOptionsManipulator
2124import io.sentry.SentryReplayEvent
@@ -340,6 +343,31 @@ class RateLimiterTest {
340343 verifyNoMoreInteractions(fixture.clientReportRecorder)
341344 }
342345
346+ @Test
347+ fun `drop log items as lost` () {
348+ val rateLimiter = fixture.getSUT()
349+ val scopes = mock<IScopes >()
350+ whenever(scopes.options).thenReturn(SentryOptions ())
351+
352+ val logEventItem = SentryEnvelopeItem .fromLogs(
353+ fixture.serializer,
354+ SentryLogEvents (
355+ listOf (
356+ SentryLogEvent (SentryId (), SentryLongDate (0 ), " hello" )
357+ )
358+ )
359+ )
360+ val envelope = SentryEnvelope (SentryEnvelopeHeader (null ), arrayListOf (logEventItem))
361+
362+ rateLimiter.updateRetryAfterLimits(" 60:log_item:key" , null , 1 )
363+ val result = rateLimiter.filter(envelope, Hint ())
364+
365+ assertNull(result)
366+
367+ verify(fixture.clientReportRecorder, times(1 )).recordLostEnvelopeItem(eq(DiscardReason .RATELIMIT_BACKOFF ), same(logEventItem))
368+ verifyNoMoreInteractions(fixture.clientReportRecorder)
369+ }
370+
343371 @Test
344372 fun `drop profileChunk items as lost` () {
345373 val rateLimiter = fixture.getSUT()
0 commit comments