Skip to content

Add mechanism to differentiate between obfuscated and non-obfuscated builds (Dart) and create internal stats board #2891

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
buenaflor opened this issue Apr 28, 2025 — with Linear · 4 comments · May be fixed by #2907
Assignees
Labels

Comments

Copy link
Contributor

buenaflor commented Apr 28, 2025

Having internal statistics about how many people actually use dart obfuscation in their apps is helpful. This information should be added in such a way so we can query it in our dashboards, e.g only adding the LoadNativeDebugImagesIntegration if it is an obfuscated event. Currently we always add this integration regardless of build type so it doesn't help us.

-> Loading debug images integration should only be done for obfuscated builds.

@github-project-automation github-project-automation bot moved this to Needs Discussion in [DEPRECATED] Mobile SDKs Apr 28, 2025
@buenaflor buenaflor changed the title Add mechanism to differentiate between obfuscated and non-obfuscated builds Add mechanism to differentiate between obfuscated and non-obfuscated builds (Dart) Apr 28, 2025
@buenaflor buenaflor self-assigned this Apr 28, 2025
@buenaflor buenaflor changed the title Add mechanism to differentiate between obfuscated and non-obfuscated builds (Dart) Add mechanism to differentiate between obfuscated and non-obfuscated builds (Dart) and create internal stats board Apr 28, 2025
@buenaflor buenaflor linked a pull request May 5, 2025 that will close this issue
6 tasks
@buenaflor buenaflor assigned denrase and unassigned buenaflor May 20, 2025
Copy link
Contributor Author

buenaflor commented May 20, 2025

Assigned this to you @denrase we want to be able to query how many events were obfuscated or not the easiest way for that is to only add the LoadNativeDebugImagesIntegration only if the build is obfuscated. Currently we always add it to the Dart integrations list which is also unnecessary so we need a isObfuscated check

I have a draft PR open, you can continue it there or take it as inspiration (or ditch it if it doesnt make sense).

This issue should also depend on the debug ID SDK side implementation as there are some changes there.

Some notes:

  • should isObfuscated only be applicable to non-web targets?
    • imo yes because web will always be minified in production and usually the word obfuscation is used for native platforms such as mobile an desktop whereas web is minified
    • if yes we should add LoadNativeDebugImagesIntegration on web always (which adds it to sdk.integration as LoadWebDebugImages and because it's always minified and debug id impl is set up in the integration) but otherwise on other targets only if the build is obfuscated
      • or we also add an isMinified check?

@buenaflor buenaflor added the Stats label May 20, 2025 — with Linear
@denrase
Copy link
Collaborator

denrase commented May 26, 2025

Just to clarify, the way I understand it, we have the following combinations:

  1. SentryFlutter.init
    a. We are on native iOS/Android: LoadNativeDebugImagesIntegration only added if isObfuscated is true.
    b. We are on web: LoadWebDebugImagesIntegration always added, regardless of isObfuscated.
    c. We are on native Windows/Linux: LoadNativeDebugImagesIntegration only added if isObfuscated is true.
  2. Sentry.init
    a. We are on native iOS/Android: LoadDartDebugImagesIntegration only added if isObfuscated is true.
    b. We are on web: LoadDartDebugImagesIntegration always added, regardless of isObfuscated.
    c. We are on native Windows/Linux: LoadDartDebugImagesIntegration only added if isObfuscated is true.
SDK Platform Obfuscated Integration
SentryFlutter iOS/Android True LoadNativeDebugImagesIntegration
SentryFlutter iOS/Android False --
SentryFlutter Web True LoadWebDebugImagesIntegration
SentryFlutter Web False LoadWebDebugImagesIntegration
SentryFlutter Windows/Linux True LoadNativeDebugImagesIntegration
SentryFlutter Windows/Linux False --
SentryDart iOS/Android True LoadDartDebugImagesIntegration
SentryDart iOS/Android False --
SentryDart Web True LoadDartDebugImagesIntegration
SentryDart Web False LoadDartDebugImagesIntegration
SentryDart Windows/Linux True LoadDartDebugImagesIntegration
SentryDart Windows/Linux False --

Even though LoadDartDebugImagesIntegration is added on linux, debug images are null, as they are not supported according to tests, but we apply the same logic as with iOS/Android, only adding if obfuscated.

@buenaflor
Copy link
Contributor Author

buenaflor commented May 29, 2025

Even though LoadDartDebugImagesIntegration is added on linux, debug images are null, as they are not supported according to tests, but we apply the same logic as with iOS/Android, only adding if obfuscated.

Yeah, that's fine. I've already done tests and it's possible to obfuscate on desktop on Dart only, we just haven't implemented it yet.

Generally I don't want to overthink this, this is going to be internal any way. What matters to me is that we don't add the integration where it doesnt make sense which in turn will let us accurately see which apps are obfuscated or not in the stats page.

For web it doesn't matter to differentiate because if you deploy a flutter web app it's always going to be minified.

I'm also fine ignoring web here and only applying isObfuscated to non-web targets so we don't overcomplicate things and also obfuscated is mainly referring to non-web targets anyway @denrase

@buenaflor
Copy link
Contributor Author

buenaflor commented May 29, 2025

SentryDart Web True LoadDartDebugImagesIntegration
SentryDart Web False LoadDartDebugImagesIntegration

Also this can be improved in the SDK, this doesn't do anything on web and should not be added there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Needs Discussion
Development

Successfully merging a pull request may close this issue.

2 participants