bugsnag / bugsnag-ruby

BugSnag error monitoring & reporting software for rails, sinatra, rack and ruby
https://docs.bugsnag.com/platforms/ruby
MIT License
249 stars 174 forks source link

Add support for adding global feature flags #753

Closed imjoehaines closed 2 years ago

imjoehaines commented 2 years ago

Goal

This PR adds support for global feature flags via Bugsnag.add_feature_flag & config.add_feature_flag. These flags are added to every future event automatically, in much the same way as global metadata works vs event-specific metadata

This is useful for flags that are not per-user but toggle features on/off for everyone at once

The APIs added are:

Bugsnag.add_feature_flag(name, variant)
Bugsnag.add_feature_flags(feature_flags)
Bugsnag.clear_feature_flag(name)
Bugsnag.clear_feature_flags

Bugsnag.configure do |config|
  config.add_feature_flag(name, variant)
  config.add_feature_flags(feature_flags)
  config.clear_feature_flag(name)
  config.clear_feature_flags
end