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 BUGSNAG_RELEASE_STAGE and use it in Bugsnag initializer #3123

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/examples/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ base: &default
daily_weekly_reports_pref: <%= ENV.fetch('ENABLE_DAILY_WEEKLY_REPORTS_PREF', '1') == '1' %>
readonly_custom_domains_settings: <%= ENV.fetch('READONLY_CUSTOM_DOMAINS_SETTINGS', '1') == '1' %>
bugsnag_api_key: <%= ENV['BUGSNAG_API_KEY'] %>
bugsnag_release_stage: <%= ENV.fetch('BUGSNAG_RELEASE_STAGE', Rails.env) %>
error_reporting_stages: <%= ENV.fetch('ERROR_REPORTING_STAGES', 'production') %>
Copy link
Contributor

Choose a reason for hiding this comment

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

wait, maybe rename this to BUGSNAG_ENABLED_RELEASE_STAGES

Copy link
Contributor

Choose a reason for hiding this comment

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

to make it more meaningful after bugsnag upgrade

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, this config (and environment variable) are not new - it already existed, I just moved it up.

I'd keep it as it is for now, and at some point (probably with the upgrade) rename both the environment variable, and the configuration name.
Just to reduce the amount of changes we do now.

events_shared_secret: <%= ENV['EVENTS_SHARED_SECRET'] %>
recaptcha_public_key: <%= ENV.fetch('RECAPTCHA_PUBLIC_KEY', 'YOUR_RECAPTCHA_PUBLIC_KEY') %>
recaptcha_private_key: <%= ENV['RECAPTCHA_PRIVATE_KEY'] %>
Expand All @@ -37,7 +39,6 @@ base: &default
enabled: <%= ENV.fetch('EMAIL_SANITIZER_ENABLED', Rails.env.preview?) %>
to: <%= ENV.fetch('EMAIL_SANITIZER_TO', 'saniziter@example.com') %>
onpremises: false
error_reporting_stages: <%= ENV.fetch('ERROR_REPORTING_STAGES', 'production') %>
apicast_staging_url: <%= ENV.fetch('APICAST_STAGING_URL', 'apicast-staging:8090') %>
zync_authentication_token: <%= ENV.fetch('ZYNC_AUTHENTICATON_TOKEN', '') %>
access_code: <%= ENV.fetch('ACCESS_CODE', '') %>
Expand Down
4 changes: 2 additions & 2 deletions config/initializers/bugsnag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Bugsnag.configure do |config|
config.api_key = Rails.configuration.three_scale.bugsnag_api_key
config.app_version = System::Deploy.info.revision
config.notify_release_stages = %w[production]
stages = Rails.configuration.three_scale.error_reporting_stages
config.notify_release_stages = stages if stages.present?
config.notify_release_stages = stages.present? ? stages : %w[production]
Copy link
Contributor

Choose a reason for hiding this comment

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

if we are not notified about errors, how would we know about them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We would get notified! Just need to set error_reporting_stages in settings.yml properly.

Example: https://github.com/3scale/3scale-saas/pull/449/files#diff-5209d018920a63ac8777bf0474e3f0ee84268d2f7cb1a51b0a5cd9bbef878b70R20

Copy link
Contributor

Choose a reason for hiding this comment

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

why not add staging by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, staging is an environment that only exists in SaaS world, so I don't know if there would be much benefit in adding it here. But we can do it also.

config.release_stage = Rails.configuration.three_scale.bugsnag_release_stage || Rails.env

ignore_error_names = ActionDispatch::ExceptionWrapper.rescue_responses.keys + ['WebHookWorker::ClientError']

Expand Down