Skip to content

Commit 81c1761

Browse files
committed
Rename to add_feature_flag
1 parent 36bc869 commit 81c1761

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

sentry_sdk/integrations/featureflags.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class FeatureFlagsIntegration(Integration):
1616
@example
1717
```
1818
import sentry_sdk
19-
from sentry_sdk.integrations.featureflags import FeatureFlagsIntegration, add_flag
19+
from sentry_sdk.integrations.featureflags import FeatureFlagsIntegration, add_feature_flag
2020
2121
sentry_sdk.init(dsn="my_dsn", integrations=[FeatureFlagsIntegration()]);
2222
23-
add_flag('my-flag', true);
23+
add_feature_flag('my-flag', true);
2424
sentry_sdk.capture_exception(Exception('broke')); // 'my-flag' should be captured on this Sentry event.
2525
```
2626
"""
@@ -33,7 +33,7 @@ def setup_once():
3333
scope.add_error_processor(flag_error_processor)
3434

3535

36-
def add_flag(flag: str, result: bool):
36+
def add_feature_flag(flag: str, result: bool):
3737
"""
3838
Records a flag and its value to be sent on subsequent error events. We recommend you do this
3939
on flag evaluations. Flags are buffered per Sentry scope and limited to 100 per event.

tests/integrations/featureflags/test_featureflags.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
import sentry_sdk
77
from sentry_sdk.integrations import _processed_integrations, _installed_integrations
8-
from sentry_sdk.integrations.featureflags import FeatureFlagsIntegration, add_flag
8+
from sentry_sdk.integrations.featureflags import (
9+
FeatureFlagsIntegration,
10+
add_feature_flag,
11+
)
912

1013

1114
@pytest.fixture
@@ -23,9 +26,9 @@ def test_featureflags_integration(sentry_init, capture_events, uninstall_integra
2326
uninstall_integration(FeatureFlagsIntegration.identifier)
2427
sentry_init(integrations=[FeatureFlagsIntegration()])
2528

26-
add_flag("hello", False)
27-
add_flag("world", True)
28-
add_flag("other", False)
29+
add_feature_flag("hello", False)
30+
add_feature_flag("world", True)
31+
add_feature_flag("other", False)
2932

3033
events = capture_events()
3134
sentry_sdk.capture_exception(Exception("something wrong!"))
@@ -48,13 +51,13 @@ def test_featureflags_integration_threaded(
4851
events = capture_events()
4952

5053
# Capture an eval before we split isolation scopes.
51-
add_flag("hello", False)
54+
add_feature_flag("hello", False)
5255

5356
def task(flag_key):
5457
# Creates a new isolation scope for the thread.
5558
# This means the evaluations in each task are captured separately.
5659
with sentry_sdk.isolation_scope():
57-
add_flag(flag_key, False)
60+
add_feature_flag(flag_key, False)
5861
# use a tag to identify to identify events later on
5962
sentry_sdk.set_tag("task_id", flag_key)
6063
sentry_sdk.capture_exception(Exception("something wrong!"))
@@ -97,13 +100,13 @@ def test_featureflags_integration_asyncio(
97100
events = capture_events()
98101

99102
# Capture an eval before we split isolation scopes.
100-
add_flag("hello", False)
103+
add_feature_flag("hello", False)
101104

102105
async def task(flag_key):
103106
# Creates a new isolation scope for the thread.
104107
# This means the evaluations in each task are captured separately.
105108
with sentry_sdk.isolation_scope():
106-
add_flag(flag_key, False)
109+
add_feature_flag(flag_key, False)
107110
# use a tag to identify to identify events later on
108111
sentry_sdk.set_tag("task_id", flag_key)
109112
sentry_sdk.capture_exception(Exception("something wrong!"))

0 commit comments

Comments
 (0)