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

sessions sent without an environment when environment option is not set - Android #2381

Closed
Tracked by #73 ...
kerenkhatiwada opened this issue Nov 21, 2022 · 4 comments · Fixed by #2610
Closed
Tracked by #73 ...
Assignees

Comments

@kerenkhatiwada
Copy link
Member

Description

Similar to getsentry/sentry-cocoa#2411

If the environment is not set for the SDK errors will default to production. However, sessions are sent without an environment.

Expected outcome: sessions would be sent with an environment
Actual outcome: sessions are sent without an environment set

Steps To Reproduce

  1. set the environment and release options
  2. Send an error event and session
  3. Observe that session and error event with the correct environment
  4. repeat without setting the environment option
  5. Observe the error event with an environment of production
  6. Observe the session with no environment
@romtsn
Copy link
Member

romtsn commented Nov 23, 2022

Let's double-check it everywhere (events, transactions, etc.)

@lbloder
Copy link
Collaborator

lbloder commented Mar 16, 2023

Events (event, exception, message) and Transactions are processed by the MainEventProcessor, which sets the default environment if the environment is null on both the Event and SentryOptions then the default is used.

So, I'm thinking of moving options.getEnvironment() != null ? options.getEnvironment() : DEFAULT_ENVIRONMENT from the MainEventProcessor to the getEnvironment() method of the SentryOptions. That should fix the problem and not introduce any duplication.
@romtsn WDYT?

@romtsn
Copy link
Member

romtsn commented Mar 17, 2023

@lbloder sounds reasonable, but this way we'd always set production even if users want to intentionally set environment to null (don't know if that could be ever useful though). At least on Cocoa we've just set the default environment to production in SentryOptions, so that should do probably? getsentry/sentry-cocoa#2447

@romtsn
Copy link
Member

romtsn commented Mar 17, 2023

ah, I see, they actually prohibited setting null values on Cocoa in addition. Alright then your suggestion totally makes sense!

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

Successfully merging a pull request may close this issue.

4 participants