Skip to content

Feature Flags: Support for the flags package #16168

Open
@bruno-garcia

Description

@bruno-garcia

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: Feature FlagsIssues related to Sentry Feature Flags Support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions