From 8b3febca42c2b3f2fe4ccc6b185118a515342114 Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Tue, 29 Apr 2025 18:20:01 +0200 Subject: [PATCH 1/4] fixed profile_chunk envelope type, while keeping the profile_chunk_ui rate limit key --- sentry/src/main/java/io/sentry/SentryItemType.java | 2 +- sentry/src/main/java/io/sentry/transport/RateLimiter.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sentry/src/main/java/io/sentry/SentryItemType.java b/sentry/src/main/java/io/sentry/SentryItemType.java index 47a0eba3c97..068c37ab1f1 100644 --- a/sentry/src/main/java/io/sentry/SentryItemType.java +++ b/sentry/src/main/java/io/sentry/SentryItemType.java @@ -15,7 +15,7 @@ public enum SentryItemType implements JsonSerializable { Attachment("attachment"), Transaction("transaction"), Profile("profile"), - ProfileChunk("profile_chunk_ui"), + ProfileChunk("profile_chunk"), ClientReport("client_report"), ReplayEvent("replay_event"), ReplayRecording("replay_recording"), diff --git a/sentry/src/main/java/io/sentry/transport/RateLimiter.java b/sentry/src/main/java/io/sentry/transport/RateLimiter.java index c2c678cbc30..6a6b5bdcada 100644 --- a/sentry/src/main/java/io/sentry/transport/RateLimiter.java +++ b/sentry/src/main/java/io/sentry/transport/RateLimiter.java @@ -191,7 +191,8 @@ private boolean isRetryAfter(final @NotNull String itemType) { return DataCategory.Attachment; case "profile": return DataCategory.Profile; - case "profile_chunk_ui": + // When we send a profile chunk, we have to check for profile_chunk_ui rate limiting, because that's what relay returns to rate limit Android. When (if) we will implement JVM profiling we will have to check both rate limits. + case "profile_chunk": return DataCategory.ProfileChunkUi; case "transaction": return DataCategory.Transaction; From 36f8a70edf394fdf5774d03b7b12d6caa1c58772 Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Tue, 29 Apr 2025 18:23:21 +0200 Subject: [PATCH 2/4] updated changelog added ProfileChunk item type ser/deser test --- CHANGELOG.md | 6 ++++++ .../io/sentry/protocol/SentryItemTypeSerializationTest.kt | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b39b437c49..5ffb91117df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Fix Android profile chunk envelope type ([#4366](https://github.com/getsentry/sentry-java/pull/4366)) + ## 8.11.0 ### Features diff --git a/sentry/src/test/java/io/sentry/protocol/SentryItemTypeSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryItemTypeSerializationTest.kt index 6e7a8191b84..68f8daa1e5d 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryItemTypeSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryItemTypeSerializationTest.kt @@ -25,6 +25,7 @@ class SentryItemTypeSerializationTest { assertEquals(serialize(SentryItemType.Attachment), json("attachment")) assertEquals(serialize(SentryItemType.Transaction), json("transaction")) assertEquals(serialize(SentryItemType.Profile), json("profile")) + assertEquals(serialize(SentryItemType.ProfileChunk), json("profile_chunk")) assertEquals(serialize(SentryItemType.ClientReport), json("client_report")) assertEquals(serialize(SentryItemType.ReplayEvent), json("replay_event")) assertEquals(serialize(SentryItemType.ReplayRecording), json("replay_recording")) @@ -41,6 +42,7 @@ class SentryItemTypeSerializationTest { assertEquals(deserialize(json("attachment")), SentryItemType.Attachment) assertEquals(deserialize(json("transaction")), SentryItemType.Transaction) assertEquals(deserialize(json("profile")), SentryItemType.Profile) + assertEquals(deserialize(json("profile_chunk")), SentryItemType.ProfileChunk) assertEquals(deserialize(json("client_report")), SentryItemType.ClientReport) assertEquals(deserialize(json("replay_event")), SentryItemType.ReplayEvent) assertEquals(deserialize(json("replay_recording")), SentryItemType.ReplayRecording) From 110cd7d2b2c3ebfd1b8b509206b1fc21a909b5fc Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Tue, 29 Apr 2025 18:24:07 +0200 Subject: [PATCH 3/4] formatted comment --- sentry/src/main/java/io/sentry/transport/RateLimiter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sentry/src/main/java/io/sentry/transport/RateLimiter.java b/sentry/src/main/java/io/sentry/transport/RateLimiter.java index 6a6b5bdcada..11a0ea02f46 100644 --- a/sentry/src/main/java/io/sentry/transport/RateLimiter.java +++ b/sentry/src/main/java/io/sentry/transport/RateLimiter.java @@ -191,7 +191,9 @@ private boolean isRetryAfter(final @NotNull String itemType) { return DataCategory.Attachment; case "profile": return DataCategory.Profile; - // When we send a profile chunk, we have to check for profile_chunk_ui rate limiting, because that's what relay returns to rate limit Android. When (if) we will implement JVM profiling we will have to check both rate limits. + // When we send a profile chunk, we have to check for profile_chunk_ui rate limiting, + // because that's what relay returns to rate limit Android. When (if) we will implement JVM + // profiling we will have to check both rate limits. case "profile_chunk": return DataCategory.ProfileChunkUi; case "transaction": From daf58a56ffbf6edd1d7412cbc41a3505724fa587 Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Wed, 30 Apr 2025 13:33:54 +0200 Subject: [PATCH 4/4] updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ffb91117df..bc13fc4b155 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixes -- Fix Android profile chunk envelope type ([#4366](https://github.com/getsentry/sentry-java/pull/4366)) +- Fix Android profile chunk envelope type for UI Profiling ([#4366](https://github.com/getsentry/sentry-java/pull/4366)) ## 8.11.0