Skip to content

Commit 8aede7e

Browse files
committed
Initialize max_flags from experimental init
1 parent b3e3bf3 commit 8aede7e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

sentry_sdk/consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class CompressionAlgo(Enum):
5959
"Experiments",
6060
{
6161
"max_spans": Optional[int],
62+
"max_flags": Optional[int],
6263
"record_sql_params": Optional[bool],
6364
"continuous_profiling_auto_start": Optional[bool],
6465
"continuous_profiling_mode": Optional[ContinuousProfilerMode],

sentry_sdk/flag_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
FlagData = TypedDict("FlagData", {"flag": str, "result": bool})
1010

1111

12+
DEFAULT_FLAG_CAPACITY = 100
13+
14+
1215
class FlagBuffer:
1316

1417
def __init__(self, capacity):

sentry_sdk/scope.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from sentry_sdk.attachments import Attachment
1313
from sentry_sdk.consts import DEFAULT_MAX_BREADCRUMBS, FALSE_VALUES, INSTRUMENTER
14-
from sentry_sdk.flag_utils import FlagBuffer
14+
from sentry_sdk.flag_utils import FlagBuffer, DEFAULT_FLAG_CAPACITY
1515
from sentry_sdk.profiler.continuous_profiler import try_autostart_continuous_profiler
1616
from sentry_sdk.profiler.transaction_profiler import Profile
1717
from sentry_sdk.session import Session
@@ -1555,7 +1555,11 @@ def __repr__(self):
15551555
def flags(self):
15561556
# type: () -> FlagBuffer
15571557
if self._flags is None:
1558-
self._flags = FlagBuffer(capacity=100)
1558+
max_flags = (
1559+
self.get_client().options["_experiments"].get("max_flags")
1560+
or DEFAULT_FLAG_CAPACITY
1561+
)
1562+
self._flags = FlagBuffer(capacity=max_flags)
15591563
return self._flags
15601564

15611565

0 commit comments

Comments
 (0)