Skip to content

Migrate from sentry-raven to sentry-ruby#7553

Closed
jeffwidman wants to merge 2 commits intomainfrom
migrate-from-sentry-raven-to-sentry-ruby
Closed

Migrate from sentry-raven to sentry-ruby#7553
jeffwidman wants to merge 2 commits intomainfrom
migrate-from-sentry-raven-to-sentry-ruby

Conversation

@jeffwidman
Copy link
Copy Markdown
Member

The Sentry team deprecated sentry-raven nearly three years ago:

So this migrates to their replacement sentry-ruby gem.

Beyond the namespace changes, the major logical changes are:

  1. Events now default to sending asynchronously using a thread pool whereas raven used to send them synchronously.
  2. The raven_context attached to exceptions is no longer automatically picked up. It must be explicitly wired in.
  3. Processor classes were removed. This didn't matter much to us as we had only a single ExceptionSanitizer, which is easily wired into the before_send() interface.
  4. The config.logger param was removed.

Copy link
Copy Markdown
Member Author

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

This was a quick spike I started on last night for fun, but it's not top priority so annotating the changes in case I don't get back to it for a bit.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm unclear if we actually need this given we already require "sentry-ruby" in fetch_files.rb/update_files.rb.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This should be quick if I can get into the debugger to see the payload, but for some reason when I drop a debugger statement here, isn't firing during unit tests... Maybe they've mocked the actual Sentry call so the caller of this (before_send()) never fires?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

TODO: still need to research if this should be replaced with anything, or simply deleted...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

TODO: need to get this to fire so I can debug this section of code, and see what the payloads look like...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ruby n00b question: What does this construct do?

I see inline assignment, does it also check if hint[:exception] is nil or does it check if it's false?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It checks whether hint[:exception] is either nil or false, that's usually called "falsy".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll need to look into this... at a minimum, I'll probably want to rename this to sentry_context

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If I can figure out how to get access to the debugger this should be straightforward...

@jeffwidman jeffwidman force-pushed the migrate-from-sentry-raven-to-sentry-ruby branch 3 times, most recently from 89a7bad to 33bcc86 Compare July 16, 2023 06:03
Comment on lines 22 to 21
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's merged, so I updated the PR, but can't resolve this TODO until it lands it an actual release and that release gets pulled into this PR...

@jeffwidman jeffwidman force-pushed the migrate-from-sentry-raven-to-sentry-ruby branch from 33bcc86 to 02a4ba9 Compare July 16, 2023 07:02
The Sentry team deprecated `sentry-raven` nearly three years ago:
* getsentry/sentry-ruby#1125

So this migrates to their replacement `sentry-ruby` gem.

Beyond the namespace changes, the major logical changes are:
1. Events now default to sending asynchronously using a thread pool
   whereas raven used to send them synchronously.
2. The `raven_context` attached to exceptions is no longer automatically
   picked up. It must be explicitly wired in.
3. Processor classes were removed. This didn't matter much to us as we
   had only a single `ExceptionSanitizer`, which is easily wired into
   the `before_send()` interface.
4. The `config.logger` param was removed.
@jeffwidman jeffwidman force-pushed the migrate-from-sentry-raven-to-sentry-ruby branch from 02a4ba9 to c4070f4 Compare July 16, 2023 08:17
@@ -1,29 +1,29 @@
# frozen_string_literal: true
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since this file is no longer using RavenProcessor, I should actually further move out the sentry-specific bits to the caller and keep this as a generic exception message processing class.

That will also make testing it a bit easier since I can test solely against exception strings.

This also means the looping through multiple exceptions should get moved to the caller, but I already have to do that anyway because of the other processing we need to do in before_send, like applying raven_context.

@jeffwidman
Copy link
Copy Markdown
Member Author

Closing in favor of @JamieMagee 's great work in #8818 .

My work wasn't entirely in vain, as we're benefiting from getsentry/sentry-ruby#2072 which I discovered while working on this draft PR.

@jeffwidman jeffwidman closed this Jan 23, 2024
@jeffwidman jeffwidman deleted the migrate-from-sentry-raven-to-sentry-ruby branch June 27, 2024 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants