Skip to content

Commit

Permalink
Add docstrs
Browse files Browse the repository at this point in the history
  • Loading branch information
aliu39 committed Dec 6, 2024
1 parent 4651b6a commit 36bc869
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions sentry_sdk/integrations/featureflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@


class FeatureFlagsIntegration(Integration):
"""
Sentry integration for buffering feature flags manually with an API and capturing them on
error events. We recommend you do this on each flag evaluation. Flags are buffered per Sentry
scope and limited to 100 per event.
See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags)
for more information.
@example
```
import sentry_sdk
from sentry_sdk.integrations.featureflags import FeatureFlagsIntegration, add_flag
sentry_sdk.init(dsn="my_dsn", integrations=[FeatureFlagsIntegration()]);
add_flag('my-flag', true);
sentry_sdk.capture_exception(Exception('broke')); // 'my-flag' should be captured on this Sentry event.
```
"""

identifier = "featureflags"

@staticmethod
Expand All @@ -14,5 +34,9 @@ def setup_once():


def add_flag(flag: str, result: bool):
"""
Records a flag and its value to be sent on subsequent error events. We recommend you do this
on flag evaluations. Flags are buffered per Sentry scope and limited to 100 per event.
"""
flags = sentry_sdk.get_current_scope().flags
flags.set(flag, result)

0 comments on commit 36bc869

Please sign in to comment.