We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm using Sentry.with_scope to add custom context information for the piece of code.
Sentry.with_scope
Also, I don't want to have Sentry initialized during my tests run. I achieved it by bailing out of sentry initializer before Sentry.init is called.
Sentry.init
It works fine except one thing. Now, code inside with_scope block is not executed at all. This behavior obviously breaks the application.
with_scope
config/initializers/sentry.rb:
config/initializers/sentry.rb
return if Rails.env.test? # Don't initialize in test environment Sentry.init do |config| config.dsn = 'MY_DSN' end
Code flow should not be affected regardless of the Sentry SDK state.
$ bundle exec rails r "Sentry.with_scope { puts 'Inside the scope' }" Inside the scope $ $ RAILS_ENV=test bundle exec rails r "Sentry.with_scope { puts 'Inside the scope' }" Inside the scope $
$ bundle exec rails r "Sentry.with_scope { puts 'Inside the scope' }" Inside the scope $ $ RAILS_ENV=test bundle exec rails r "Sentry.with_scope { puts 'Inside the scope' }" $
In a nutshell, when I'm in a test environment (Sentry.init was not called), my code is not working.
3.0.4
5.4.2
sentry-ruby (5.4.2)
No response
The text was updated successfully, but these errors were encountered:
Thanks for reporting. I'll open a PR shortly
Sorry, something went wrong.
st0012
Successfully merging a pull request may close this issue.
Issue Description
I'm using
Sentry.with_scope
to add custom context information for the piece of code.Also, I don't want to have Sentry initialized during my tests run. I achieved it by bailing out of sentry initializer before
Sentry.init
is called.It works fine except one thing. Now, code inside
with_scope
block is not executed at all. This behavior obviously breaks the application.Reproduction Steps
config/initializers/sentry.rb
:Expected Behavior
Code flow should not be affected regardless of the Sentry SDK state.
Actual Behavior
In a nutshell, when I'm in a test environment (
Sentry.init
was not called), my code is not working.Ruby Version
3.0.4
SDK Version
5.4.2
Integration and Its Version
sentry-ruby (5.4.2)
Sentry Config
No response
The text was updated successfully, but these errors were encountered: