Skip to content

Feature Flags: Support for the flags package #16168

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

Open
bruno-garcia opened this issue Apr 30, 2025 · 0 comments
Open

Feature Flags: Support for the flags package #16168

bruno-garcia opened this issue Apr 30, 2025 · 0 comments
Labels
Feature: Feature Flags Issues related to Sentry Feature Flags Support

Comments

@bruno-garcia
Copy link
Member

Description

The flags npm package from vercel is getting quite popular:

Image

Since Sentry now has support for capturing feature flags from the client, so that events and spans are tagged with the relevant flags.
This ticket suggesting expanding the JS support for the flags package.

@dferber90 from Vercel created a gist where we can get a list of flags evaluated in a way that supports streaming:

https://gist.github.com/dferber90/da452f324bb4a06d649a2000a5c7d881

Whether we create a @sentry/flags or add it to the core so we can reuse it more easily across other frameworks might depend on the bundle size impact, so that needs to be tested.

This bit could become a core part of the SDK itself though that could be part of a separate task:

const scope = getCurrentScope();
const flagContext = scope.getScopeData().contexts.flags;
const flagBuffer = flagContext ? flagContext.values : [];
if (!flagBuffer.length) {
return event;
}
if (event.contexts === undefined) {
event.contexts = {};
}
event.contexts.flags = { values: [...flagBuffer] };
return event;
}

@bruno-garcia bruno-garcia added the Feature: Feature Flags Issues related to Sentry Feature Flags Support label Apr 30, 2025
@linear linear bot added the Task label Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Feature Flags Issues related to Sentry Feature Flags Support
Projects
None yet
Development

No branches or pull requests

2 participants