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

Add missing initialized? checks to sentry-rails #1919

Merged
merged 1 commit into from
Oct 21, 2022

Conversation

sl0thentr0py
Copy link
Member

The at_exit Sentry.close call might cause these Sentry.get_current_scopes to return nil and break some setups.

Fixes #1885

@st0012
Copy link
Collaborator

st0012 commented Oct 20, 2022

Can you add a changelog entry too? Thx

@sl0thentr0py
Copy link
Member Author

I always forget the changelog :(
I'm thinking of adding a bot for this.
Relay uses https://github.com/getsentry/relay/blob/master/.github/workflows/danger.yml

@st0012
Copy link
Collaborator

st0012 commented Oct 20, 2022

I thought about using GH's release to automatically generate changelogs, but it doesn't fit our release flow (having changelog before releasing).
I'd be happy to try the workflow you mentioned 👍

@sl0thentr0py
Copy link
Member Author

sl0thentr0py commented Oct 20, 2022

@st0012 craft actually supports changelog: auto on release but I'm not happy with the quality of the generated changelogs (lots of noise). I actually like your changelogs a lot, so I want to keep doing it this way here. :)

@st0012
Copy link
Collaborator

st0012 commented Oct 20, 2022

@sl0thentr0py Thanks for your kind words ❤️

@cleptric
Copy link
Member

Sorry to chime in, but the Ruby SDK changelogs are a staple at Sentry. Pls keep this 🚀

@cleptric cleptric closed this Oct 20, 2022
@cleptric cleptric reopened this Oct 20, 2022
@sl0thentr0py sl0thentr0py merged commit d3d3568 into master Oct 21, 2022
@sl0thentr0py sl0thentr0py deleted the neel/fix-close-holes branch October 21, 2022 09:38
@st0012 st0012 modified the milestones: 6.0.0, 5.6.0 Oct 23, 2022
@@ -3,6 +3,7 @@ module Rails
module ControllerTransaction
def self.included(base)
base.prepend_before_action do |controller|
return unless Sentry.initialized?
Copy link

Choose a reason for hiding this comment

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

This code generates a LocalJumpError: unexpected return error in my install. I'm pulling sentry-ruby from source to try and mitigate the same problem as in #1885, which shows up in our test environments. (It shows up even though we're not using guard, so the workaround from that issue didn't work for us)

I'm using Rails 6.1.6 with Ruby 2.7.6p219

Instead, using a basic conditional like this was enough to make our tests pass:

          if Sentry.initialized?
            Sentry.get_current_scope.set_transaction_name("#{controller.class}##{controller.action_name}", source: :view)
          end

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

oof my bad, thx @gareth

Copy link
Member Author

Choose a reason for hiding this comment

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

sl0thentr0py added a commit that referenced this pull request Oct 25, 2022
sl0thentr0py added a commit that referenced this pull request Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using guard to run integration tests results in undefined method `set_transaction_name' for nil:NilClass
4 participants