-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
Culprits -> Transactions #743
Conversation
8fc2b4f
to
68860ae
Compare
Intended to be the "ruby" version of getsentry/raven-python#768 |
We're gonna need a stack as well for things like someone running Sidekiq inline (transaction top-level is the Rails controller action, then lowest-level will be the Sidekiq job.) |
597205f
to
f03d540
Compare
f03d540
to
8cdb899
Compare
+ Cleanup Rack tests
This PR also fixes some bugs with Sidekiq:
|
@nateberkopec this PR looks to have broken something for me. I have my own around_action callbacks defined within my application. # Wrap all actions in delayed touch.
prepend_around_action :delay_touching
# Delay touching to once per
# transaction to prevent the noise
def delay_touching
# Use the gem to wrap every action within the app.
ActiveRecord::Base.delay_touching { yield }
end This worked up until this PR was merged in, all builds after that date result in an error being raised by my own around_action.
Is the new around_action behavior you've defined augmenting the request in a way it shouldn't? Meaning that the block has been stripped by the time it arrives in my own handler? |
Yeah I'm seeing the same on Codetriage. Working on it. |
I think it's also worth noting that this change broke compatibility with Rails 3 (I think). The README states that it works with Rails 4.2+, so I guess this is fair game, but it was working well enough in Rails 3, even so. Nonetheless, for posterity and future readers, I thought it noteworthy. Rails 3.x will get the following exception:
|
🤷♂️ |
Culprit was renamed to transaction in Raven 2.7.0, which introduced errors here. See getsentry/sentry-ruby#743
The change from Is there a way to configure Raven so that I can be confident that I'm using the interface correctly in tests? It looks like it will take any hash at all without complaint in |
@ragesoss Good point. In my head this wasn't a breaking change because the Sentry server accepts culprit and transaction, but if you're manually putting a culprit on the event and then we add a transaction attribute, Sentry will ignore the former. Are you saying it raised an exception in production? I don't see how that would occur. |
@nateberkopec Here's what the call site was (the old version): WikiEducationFoundation/WikiEduDashboard@ccff70d And the error (which was itself caught by Sentry and reported):
|
Ah, crap. You're right. I should have left an alias in. Sorry about that. If you want errors like this to surface in your test suite, Raven needs to be configured to actually capture events in that environment. Of course you probably don't want messages and stuff from the test environment to show up on your Sentry dashboard, so this may be a good time to use the Here's an example, which is how we test Raven in the gem: require "raven/transports/dummy"
Raven.configure do |config|
config.dsn = "dummy:https://12345:[email protected]/sentry/42"
config.encoding = "json"
logger = Logger.new(nil)
config.logger = logger
end You can then make assertions against the state of the dummy transport: evt = Raven.client.transport.events.first[1]
assert_equal "test", JSON.parse(evt)["environment"] |
@nateberkopec awesome, thanks! I did it in the Raven initializer, like this: WikiEducationFoundation/WikiEduDashboard@a785d76 |
Whoops. Just in case anyone reading this issue tries to follow that example... |
Ah yeah, |
Culprit was renamed to transaction in Raven 2.7.0, which introduced errors here. See getsentry/sentry-ruby#743
This was renamed in sentry-raven 2.7.0: getsentry/sentry-ruby#743 We updated from sentry-raven 2.4.0 to 2.9.0 in #132, but we have no test coverage here, so we didn't spot it.
Close #667.
This also allows anyone to set a culprit by setting
culprit
in the context object.