Open cleptric opened 1 year ago
@cleptric I’m happy to create the code and PR for this if you would like?
@martinbean Hey, thanks a lot! In order to create meaningful spans & breadcrumbs, we would need new events added to pennant, that fire before a feature is retrieved, see https://github.com/laravel/pennant/issues/41.
@cleptric Why would Sentry need an event before a feature is retrieved? Would you not want to add a breadcrumb after a feature and its value has been resolved?
We already trace all DB queries related to retrieving a feature, so the only addition here would be to wrap these queries into a new span and create a breadcrumb before the DB queries are run. This is mostly about better UX in the product.
In addition to @cleptric their comments, having an event before & after means we know when the framework started and finished resolving the feature flag, meaning we know how long it took and which (if any) database queries or other expensive operations took place while resolving the flag. This gives much insights in the timing. So for just breadcrumbs the "after" is enough but for the performance spans the "before" is a must.
Laravel Pennant is a new feature flagging library for Laravel.
There are currently two events dispatched,
FeatureRetrieved
andFeatureResolved
.We could try contributing new
FeatureRetrieve
andFeatureResolve
events upstream, or use decorators, so we are able to wrap the code or DB query executed into a span, containing the feature identifier and result.