Skip to content

Commit 096c5c0

Browse files
authored
Send UI Profiling app start chunk when it finishes (#4423)
* init the scopes at profile finish, too, so that it sends the chunk the first time
1 parent 0a72b67 commit 096c5c0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Send UI Profiling app start chunk when it finishes ([#4423](https://github.com/getsentry/sentry-java/pull/4423))
8+
39
## 8.13.2
410

511
### Fixes

sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public void startProfiler(
151151
}
152152
}
153153

154-
private void start() {
154+
private void initScopes() {
155155
if ((scopes == null || scopes == NoOpScopes.getInstance())
156156
&& Sentry.getCurrentScopes() != NoOpScopes.getInstance()) {
157157
this.scopes = Sentry.getCurrentScopes();
@@ -162,6 +162,10 @@ private void start() {
162162
rateLimiter.addRateLimitObserver(this);
163163
}
164164
}
165+
}
166+
167+
private void start() {
168+
initScopes();
165169

166170
// Debug.startMethodTracingSampling() is only available since Lollipop, but Android Profiler
167171
// causes crashes on api 21 -> https://github.com/getsentry/sentry-java/issues/3392
@@ -252,6 +256,7 @@ public void stopProfiler(final @NotNull ProfileLifecycle profileLifecycle) {
252256
}
253257

254258
private void stop(final boolean restartProfiler) {
259+
initScopes();
255260
try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
256261
if (stopFuture != null) {
257262
stopFuture.cancel(true);

0 commit comments

Comments
 (0)