Monitor errors as you roll out features or run experiments and A/B tests by declaring your feature flag and experiment usage in the BugSnag client. You can use the Features dashboard to identify whether these features have introduced errors into your app.
This documentation is for the latest BugSnag Expo libraries. Please see our guidance on support for Expo SDK 43 or earlier.
You should declare feature flag and experiment usage to BugSnag at the time a feature or experiment is activated in your app. This ensures that subsequent errors will be associated with the feature flag or experiment usage accurately.
These operations are also available in configuration options. If feature or experiment usage is known at the time you initialize BugSnag, you may wish to declare it in configuration, then update it later in the same app session if required.
You can either declare the usage using the following methods on the BugSnag client or in a callback on an Event
object.
addFeatureFlag
Declare a single feature flag or experiment with variant as an optional second parameter.
Bugsnag.addFeatureFlag('Checkout button color', 'Blue')
Bugsnag.addFeatureFlag('New checkout flow')
addFeatureFlags
Declare multiple feature flags or experiments.
Bugsnag.addFeatureFlags([
{ name: 'Checkout button color', variant: 'Blue' },
{ name: 'Special offer', variant: 'Free Coffee' },
{ name: 'New checkout flow' },
])
If addFeatureFlags
is called again, the new data will be merged with any existing feature flags with the newer variant values taking precedence.
clearFeatureFlag
Remove a single feature flag or experiment.
Bugsnag.clearFeatureFlag('Checkout button color')
clearFeatureFlags
Remove all feature flags and experiments.
Bugsnag.clearFeatureFlags()
To use BugSnag with Split:
const factory = SplitFactory(/* ... */)
const client = factory.client()
app.get('/purchase/:productId', function (req, res, next) {
const treatment = client.getTreatment('key', 'SPLIT_NAME')
Bugsnag.addFeatureFlag('SPLIT_NAME', treatment)
// ...
})
For more information, please see the Split Node.js SDK documentation.