-
Notifications
You must be signed in to change notification settings - Fork 522
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
feat(flags): add Statsig integration #4022
base: master
Are you sure you want to change the base?
Conversation
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky tests
To view more test analytics, go to the Test Analytics Dashboard |
flags = sentry_sdk.get_current_scope().flags | ||
flags.set(gate, enabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a function for this:
sentry-python/sentry_sdk/feature_flags.py
Line 35 in 9ff100a
def add_feature_flag(flag, result): |
import importlib | ||
|
||
try: | ||
# The statsig package has the same name as this file. We use importlib to avoid conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't an issue in the openfeature integration:
sentry-python/sentry_sdk/integrations/openfeature.py
Lines 6 to 14 in 9ff100a
try: | |
from openfeature import api | |
from openfeature.hook import Hook | |
if TYPE_CHECKING: | |
from openfeature.flag_evaluation import FlagEvaluationDetails | |
from openfeature.hook import HookContext, HookHints | |
except ImportError: | |
raise DidNotEnable("OpenFeature is not installed") |
New integration for tracking Statsig (pypi) flag evaluations, specifically the checkGate method which is used for boolean release flags. Unlike JS, there's no support for event callbacks for Statsig's server SDKs. Instead we wrap the module-level
check_gate
function.Ref https://develop.sentry.dev/sdk/expected-features/#feature-flags
Ref