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

Conversation

mayorova
Copy link
Contributor

@mayorova mayorova commented Nov 28, 2022

This is a way to set a different releaseStage metadata on Bugsnag (e.g. staging), while still using RAILS_ENV=production)

NOTE: In order to use a different environment Rails.configuration.three_scale.error_reporting_stages (in settings.yml) must be changed to include the new environment.

This env var as added as default one in Bugsnag Ruby in 6.16, see the PR and the release notes.

@mayorova mayorova changed the title Add THREESCALE_ENVIRONMENT and use it in Bugsnag initializer Add BUGSNAG_RELEASE_STAGE and use it in Bugsnag initializer Nov 28, 2022
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.

@@ -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.

@mayorova mayorova merged commit 04fcc22 into master Nov 29, 2022
@mayorova mayorova deleted the add-bugsnag-release-stage branch November 29, 2022 12:07
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