Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Update profile chunk rate limit and client report ([#4353](https://github.com/getsentry/sentry-java/pull/4353))

## 8.9.0

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private void start() {
final @Nullable RateLimiter rateLimiter = scopes.getRateLimiter();
if (rateLimiter != null
&& (rateLimiter.isActiveForCategory(All)
|| rateLimiter.isActiveForCategory(DataCategory.ProfileChunk))) {
|| rateLimiter.isActiveForCategory(DataCategory.ProfileChunkUi))) {
logger.log(SentryLevel.WARNING, "SDK is rate limited. Stopping profiler.");
// Let's stop and reset profiler id, as the profile is now broken anyway
stop(false);
Expand Down Expand Up @@ -385,7 +385,7 @@ public int getRootSpanCounter() {
public void onRateLimitChanged(@NotNull RateLimiter rateLimiter) {
// We stop the profiler as soon as we are rate limited, to avoid the performance overhead
if (rateLimiter.isActiveForCategory(All)
|| rateLimiter.isActiveForCategory(DataCategory.ProfileChunk)) {
|| rateLimiter.isActiveForCategory(DataCategory.ProfileChunkUi)) {
logger.log(SentryLevel.WARNING, "SDK is rate limited. Stopping profiler.");
stop(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ class AndroidContinuousProfilerTest {
fun `profiler stops when rate limited`() {
val profiler = fixture.getSut()
val rateLimiter = mock<RateLimiter>()
whenever(rateLimiter.isActiveForCategory(DataCategory.ProfileChunk)).thenReturn(true)
whenever(rateLimiter.isActiveForCategory(DataCategory.ProfileChunkUi)).thenReturn(true)

profiler.startProfiler(ProfileLifecycle.MANUAL, fixture.mockTracesSampler)
assertTrue(profiler.isRunning)
Expand All @@ -521,7 +521,7 @@ class AndroidContinuousProfilerTest {
fun `profiler does not start when rate limited`() {
val profiler = fixture.getSut()
val rateLimiter = mock<RateLimiter>()
whenever(rateLimiter.isActiveForCategory(DataCategory.ProfileChunk)).thenReturn(true)
whenever(rateLimiter.isActiveForCategory(DataCategory.ProfileChunkUi)).thenReturn(true)
whenever(fixture.scopes.rateLimiter).thenReturn(rateLimiter)

// If the SDK is rate limited, the profiler should never start
Expand Down
2 changes: 1 addition & 1 deletion sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public final class io/sentry/DataCategory : java/lang/Enum {
public static final field Error Lio/sentry/DataCategory;
public static final field Monitor Lio/sentry/DataCategory;
public static final field Profile Lio/sentry/DataCategory;
public static final field ProfileChunk Lio/sentry/DataCategory;
public static final field ProfileChunkUi Lio/sentry/DataCategory;
public static final field Replay Lio/sentry/DataCategory;
public static final field Security Lio/sentry/DataCategory;
public static final field Session Lio/sentry/DataCategory;
Expand Down
2 changes: 1 addition & 1 deletion sentry/src/main/java/io/sentry/DataCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public enum DataCategory {
Attachment("attachment"),
Monitor("monitor"),
Profile("profile"),
ProfileChunk("profile_chunk"),
ProfileChunkUi("profile_chunk_ui"),
Transaction("transaction"),
Replay("replay"),
Span("span"),
Expand Down
2 changes: 1 addition & 1 deletion sentry/src/main/java/io/sentry/SentryItemType.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum SentryItemType implements JsonSerializable {
Attachment("attachment"),
Transaction("transaction"),
Profile("profile"),
ProfileChunk("profile_chunk"),
ProfileChunk("profile_chunk_ui"),
ClientReport("client_report"),
ReplayEvent("replay_event"),
ReplayRecording("replay_recording"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private DataCategory categoryFromItemType(SentryItemType itemType) {
return DataCategory.Profile;
}
if (SentryItemType.ProfileChunk.equals(itemType)) {
return DataCategory.ProfileChunk;
return DataCategory.ProfileChunkUi;
}
if (SentryItemType.Attachment.equals(itemType)) {
return DataCategory.Attachment;
Expand Down
4 changes: 2 additions & 2 deletions sentry/src/main/java/io/sentry/transport/RateLimiter.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ private boolean isRetryAfter(final @NotNull String itemType) {
return DataCategory.Attachment;
case "profile":
return DataCategory.Profile;
case "profile_chunk":
return DataCategory.ProfileChunk;
case "profile_chunk_ui":
return DataCategory.ProfileChunkUi;
case "transaction":
return DataCategory.Transaction;
case "check_in":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class RateLimiterTest {
val attachmentItem = SentryEnvelopeItem.fromAttachment(fixture.serializer, NoOpLogger.getInstance(), Attachment("{ \"number\": 10 }".toByteArray(), "log.json"), 1000)
val envelope = SentryEnvelope(SentryEnvelopeHeader(), arrayListOf(profileChunkItem, attachmentItem))

rateLimiter.updateRetryAfterLimits("60:profile_chunk:key", null, 1)
rateLimiter.updateRetryAfterLimits("60:profile_chunk_ui:key", null, 1)
val result = rateLimiter.filter(envelope, Hint())

assertNotNull(result)
Expand Down
Loading