Skip to content
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

fix(streamline): Fix the logic for the experiment #83661

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions src/sentry/issues/streamline.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
from random import random

from sentry import options
from sentry.models.organization import Organization
from sentry.utils.options import sample_modulo


def apply_streamline_rollout_group(organization: Organization):
# If the rollout_result is false, the organization is not in the experiment.
rollout_result = sample_modulo(
"issues.details.streamline-experiment-rollout-rate", organization.id
)
# This shouldn't run multiple times, but if it does, don't re-sort the organization.
# If they're already in the experiment, we ignore them.
if organization.get_option("sentry:streamline_ui_only") is not None:
return

rollout_rate = options.get("issues.details.streamline-experiment-rollout-rate")

if rollout_result:
# If split_result is true, they only receive the Streamline UI.
# If split_result is false, they only receive the Legacy UI.
# If the random number is less than the rollout_rate, the organization is in the experiment.
if random() <= rollout_rate:
split_rate = options.get("issues.details.streamline-experiment-split-rate")
# If the random number is less than the split_rate, the split_result is true.
split_result = random() <= split_rate
# When split_result is true, they only receive the Streamline UI.
# When split_result is false, they only receive the Legacy UI.
# This behaviour is controlled on the frontend.
split_result = sample_modulo(
"issues.details.streamline-experiment-split-rate", organization.id
)
organization.update_option("sentry:streamline_ui_only", split_result)
Loading