Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add masking debug overlay #4357

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

markushi
Copy link
Member

@markushi markushi commented Apr 25, 2025

📜 Description

Masks, revealed
For debugging purposes

Screenshot_20250425_101151

TBD:

  • Do we want to expose this via options?
  • How can we ensure the flag to turn it on isn't accidentally committed

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

@markushi markushi requested a review from romtsn April 25, 2025 08:11
Copy link
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Add masking debug overlay ([#4357](https://github.com/getsentry/sentry-java/pull/4357))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against d1a9c45

Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 425.81 ms 493.12 ms 67.31 ms
Size 1.58 MiB 2.08 MiB 507.64 KiB

canvas.drawRect(mask, paint)

paint.style = Paint.Style.FILL
val label = "${mask.left} ${mask.top}"
Copy link
Member

@romtsn romtsn Apr 25, 2025

Choose a reason for hiding this comment

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

ideally I'd want to have bottom and right too, shall we maybe use a smaller textSize but include all the bounds? e.g. in this format 0, 0 - 1, 1

paint.strokeWidth = 4f

for (mask in masks) {
paint.setColor(Color.BLACK)
Copy link
Member

Choose a reason for hiding this comment

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

wondering if we should use Color.RED (or some other which is more prominent in case of a black/white background for example)

paint
)
paint.setColor(Color.BLACK)
canvas.drawText(
Copy link
Member

Choose a reason for hiding this comment

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

could we actually draw this label outside the mask rect? I think it's nicer visually and wouldn't potentially overlap the content inside the mask (which may be useful to see in some cases)

@romtsn
Copy link
Member

romtsn commented Apr 25, 2025

Do we want to expose this via options?
How can we ensure the flag to turn it on isn't accidentally committed

Yeah so I talked to @krystofwoldrich yesterday, and turns out iOS also has a similar option - we were thinking of introducing a top-level api like Sentry.toggleMaskingDebugOverlay() so it can be used with some kind of a debug/floating button and easily controlled at runtime instead of an init option. Wdyt?

@krystofwoldrich
Copy link
Member

Cocoa has SentrySDK.replay.showMaskPreview(0.5), the number is opacity of the overlay.

Related cocoa PRs:

@romtsn
Copy link
Member

romtsn commented Apr 25, 2025

Cocoa has SentrySDK.replay.showMaskPreview(0.5), the number is opacity of the overlay.

Related cocoa PRs:

alright, couldn't we draw stroke rectangles instead of solid? then we wouldn't need the opacity parameter. Just trying to align I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants