bugsnag / bugsnag-laravel

BugSnag notifier for the Laravel PHP framework. Monitor and report Laravel errors.
https://docs.bugsnag.com/platforms/php/laravel/
MIT License
876 stars 129 forks source link

Integrate with Pennant feature flags #526

Open martinbean opened 1 year ago

martinbean commented 1 year ago

Laravel launched Pennant, a feature flag package, alongside version 10.x of the framework.

Pennant raises events when resolving a known feature, so the Bugsnag package could hook in to this event and automatically declare a feature flag, as documented here: https://docs.bugsnag.com/platforms/php/laravel/features-experiments/

Code would look something like this:

$events->listen('Laravel\Pennant\Events\FeatureResolved', function ($event) {
    $this->app->bugsnag->addFeatureFlag($event->feature, $event->value);
});

It should probably be wrapped in a conditional so that developers can choose to enable or disable this automatically capturing of feature flag values, though. Maybe an environment variable-backed configuration value like BUGSNAG_CAPTURE_PENNANT_FEATURES or something.

Happy to code this up and open a PR if it’s something that would be welcomed in the package.

johnkiely1 commented 1 year ago

Hi @martinbean, Thanks for the suggestion, we agree it sounds like a good idea. A little bit of internal discussion suggests this may end up a being more complex to implement than what you are suggesting along with requiring end to end testing. While we appreciate the offer of the PR, on this occasion it may be best for us to do it in house. To that end we have added a task to the backlog and we will post here as soon as we have updates to share.