-
Notifications
You must be signed in to change notification settings - Fork 174
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 support for feature flags #758
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This returns true if: - name is a string with at least 1 character - variant is nil OR variant is a string
The FeatureFlagDelegate now ensures flags are valid before storing them, so we no longer deliver flags with invalid names
This allows users to add feature flags to Bugsnag whenever they interact with their feature flag service, e.g. ```ruby flag = get_flag_from_service('new-login-page') if flag.enabled? Bugsnag.add_feature_flag('new-login-page') # render new login page else Bugsnag.clear_feature_flag('new-login-page') # render old login page end ``` The previous implementation relied on event's already being request specific, but meant feature flags would usually have to be added in an on_error callback
Now that the implementations of add_/clear_feature_flag(s) are the same, we can use a module to implement these methods and save us from having copy pasted methods/docs in 3 places
This embeds methods from included modules directly into the class' docs, rather than linking to them separately This makes the docs a lot clearer when a class includes some methods from a module as they are now listed next to every other method
tomlongridge
approved these changes
Nov 30, 2022
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
This PR adds support for feature flags to Bugsnag-ruby
The new APIs are available on both the
Bugsnag
module and invidiual events (viaon_error
callbacks):add_feature_flag
Declare a single feature flag or experiment with variant as an optional second parameter.
add_feature_flags
Declare multiple feature flags or experiments.
If
add_feature_flags
is called again, the new data will be merged with any existing feature flags with the newer variant values taking precedence.clear_feature_flag
Remove a single feature flag or experiment.
clear_feature_flags
Remove all feature flags and experiments.