Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite committed Dec 17, 2024
1 parent 8eb13c8 commit da8c194
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions posthog/api/decide.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
labelnames=[LABEL_TEAM_ID, "errors_computing", "has_hash_key_override"],
)

REMOTE_CONFIG_CACHE_COUNTER = Counter(
"posthog_remote_config_for_decide",
"Metric tracking whether Remote Config was used for decide",
labelnames=["result"],
)


def get_base_config(token: str, team: Team, request: HttpRequest, skip_db: bool = False) -> dict:
use_remote_config = False
Expand All @@ -58,6 +64,8 @@ def get_base_config(token: str, team: Team, request: HttpRequest, skip_db: bool
if random() < settings.REMOTE_CONFIG_DECIDE_ROLLOUT_PERCENTAGE:
use_remote_config = True

REMOTE_CONFIG_CACHE_COUNTER.labels(result=use_remote_config).inc()

if use_remote_config:
response = RemoteConfig.get_config_via_token(token, request=request)

Expand Down

0 comments on commit da8c194

Please sign in to comment.