Skip to content
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

Why devMode is marked as @internal? #1620

Closed
feinstein opened this issue Aug 31, 2023 · 8 comments · Fixed by #1664
Closed

Why devMode is marked as @internal? #1620

feinstein opened this issue Aug 31, 2023 · 8 comments · Fixed by #1664

Comments

@feinstein
Copy link

Problem Statement

devMode is marked as @internal so we get a warning when we try to use it:

  @internal
  bool devMode = false;

Is there a reason for this to be @internal? I can see it being useful to be used as devMode = kDebugMode. This way we get exceptions when we are developing.

Solution Brainstorm

No response

Are you willing to submit a PR?

None

@buenaflor
Copy link
Contributor

@denrase afaik this is one of the issues you worked on, maybe you have more context on this

@denrase
Copy link
Collaborator

denrase commented Sep 4, 2023

We just use this internally in test expectations. When enabled, exceptions in user provided closures are re-thrown instead of being swallowed by the SDK. I'm not aware of any effort to make this a public API, so you should not rely on this flag being present in future releases. Maybe @kahest has some thoughts?

@kahest
Copy link
Member

kahest commented Sep 4, 2023

As @denrase mentioned, this is not intended or tested to be used outside of automated tests.

@feinstein what is the goal you are trying to achieve? Maybe there is a better way to solve this that is more in line with our SDK design principles.

@feinstein
Copy link
Author

Correct me if I am wrong please, as I did a very quick look at the source code. I thought I could set devMode when kDebugMode, so no alerts are sent to Sentry when we are coding and thus generating a bunch of exceptions.

Also to control if exceptions/logs are shown in the console, for development, or are redirected to sentry only for production builds.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Sep 4, 2023
@buenaflor
Copy link
Contributor

buenaflor commented Sep 4, 2023

so no alerts are sent to Sentry when we are coding and thus generating a bunch of exceptions.

In that case I'd suggest using beforeSend if you haven't yet. You can configure it to filter out events based on your environment (dev, staging, prod, etc... for example).

@denrase
Copy link
Collaborator

denrase commented Sep 11, 2023

@feinstein You have several options to achieve what you want:

You can enable the options.debug flag to log issues that might occur.

As for not sending events when developing locally, you can always just opt to not init the SDK, or, like @buenaflor mentioned, filter out all events in beforeSend

Another option might be to setup different environments with the [options.environment] flag. You can then filter your issues in the web UI.

The documentation of those flags has more infos that might be of interest to you.

@denrase
Copy link
Collaborator

denrase commented Sep 11, 2023

@kahest Maybe calling this internal testing flag devMode is an issue in itself.

@stefanosiano
Copy link
Member

@denrase let's rename it to automatedTestMode and add a comment to explicitly say that it's only used for tests

@stefanosiano stefanosiano self-assigned this Sep 28, 2023
@stefanosiano stefanosiano moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Sep 28, 2023
@denrase denrase assigned denrase and unassigned stefanosiano Oct 3, 2023
@denrase denrase moved this from Backlog to In Progress in Mobile & Cross Platform SDK Oct 3, 2023
denrase added a commit that referenced this issue Oct 3, 2023
@denrase denrase moved this from In Progress to Needs Review in Mobile & Cross Platform SDK Oct 3, 2023
@github-project-automation github-project-automation bot moved this from Needs Review to Done in Mobile & Cross Platform SDK Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants