Skip to content

Send UI Profiling app start chunk when it finishes #4423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- Use `Sentry.replay().enableDebugMaskingOverlay()` to overlay the screen with the Session Replay masks.
- The masks will be invalidated at most once per `frameRate` (default 1 fps).

### Fixes

- Send UI Profiling app start chunk when it finishes ([#4423](https://github.com/getsentry/sentry-java/pull/4423))

## 8.12.0

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void startProfiler(
}
}

private void start() {
private void initScopes() {
if ((scopes == null || scopes == NoOpScopes.getInstance())
&& Sentry.getCurrentScopes() != NoOpScopes.getInstance()) {
this.scopes = Sentry.getCurrentScopes();
Expand All @@ -162,6 +162,10 @@ private void start() {
rateLimiter.addRateLimitObserver(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be potentially added multiple times now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it checks for scopes == null, so it should never occur more than once

}
}
}

private void start() {
initScopes();

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

private void stop(final boolean restartProfiler) {
initScopes();
try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
if (stopFuture != null) {
stopFuture.cancel(true);
Expand Down
Loading