getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
927 stars 493 forks source link

Add rake command for adding rails initializer #2218

Closed sl0thentr0py closed 2 months ago

sl0thentr0py commented 8 months ago

we want to make it easier for rails users to setup sentry, see https://fly.io/docs/reference/sentry/#ruby-on-rails and https://github.com/getsentry/sentry-wizard

st0012 commented 6 months ago

If this only targets Rails apps, maybe we can use Rails' generator instead?

It also supports cli options. So once this is completed, we can just generate a one line command on the web UI like:

bundle exec bin/rails generate sentry --dsn <user DSN> --enable-profiling true
sl0thentr0py commented 6 months ago

yep also a possibility!

smeubank commented 5 months ago

some questions TBD (see sentry-wizard and how they do it)

  • DSN
  • enable performance
  • enable profiling

We do not enable profiling OOTB with wizards, and there are not prompts as far as I know, to ask the user if they want the wizard to add it.

Ruby doesn't have to worry about uploading source context, it automatically sends sessions and attempts to set unique release values. Those would be the typical prompts we'd try to solve for, we should validate the release detection works as we expect.

For the DSN there is a login flow, which there are some cases we manage via the wizard well, and some we do not manage well. see -> https://github.com/getsentry/sentry-wizard/issues/357 but this is more related to the org auth token

Setup Wizards: dev spec

fwiw I don't think detailed feature selection is first prio, but they are considering it for the other wizards as well: https://github.com/getsentry/sentry-wizard/issues/558

Also, after chatting with Neel, I understand the steps for rails set up could become install and configure with this initializer command, which could trigger a CLI wizard like flow

is there a way that the install step could be combined? Like what we do with the other wizards?

npx @sentry/wizard@latest -i nextjs

st0012 commented 5 months ago

Personally, I wouldn't want to install a npm package just to have it help me set up a SDK, unless it provides significantly better experience. In the Rails community, installing a gem and run its associated Rails generator command for configuration is a pretty standard practice. For example, bugsnag and airbrake have Rails generators too. But I don't think Rails generators can provide the same interactive experience like the wizard does.

FWIW, appsignal provides a library-agnostic executable to provide a rich installation or even diagnose experience. This may be closer to what we want to achieve with wizard? That said, IMO this is not something the Ruby SDK team should prioritize the resource for.

For the DSN there is a login flow

Is there any doc or example to show this is achieved?

smeubank commented 5 months ago

Personally, I wouldn't want to install a npm package just to have it help me set up a SDK

fair, we also made it available via brew for mobile platforms, for similar reasons. I don't know if something similar is possible for ruby gem's, to make it available in way that would make sense for ruby devs, and even ideally delete it after the wizard is complete.

FWIW, appsignal provides a library-agnostic executable to provide a rich installation or even diagnose experience. This may be closer to what we want to achieve with wizard? That said, IMO this is not something the Ruby SDK team should prioritize the resource for.

without any insight into how much effort it would be, I don't think it is a high prio either, we can create a different ticket to track it for possible future work

For the DSN there is a login flow

Is there any doc or example to show this is achieved?

@Lms24 do you have more insights to share about the project selection to fetch the correct DSN?

sl0thentr0py commented 2 months ago

added in https://github.com/getsentry/sentry-ruby/releases/tag/5.18.0