Skip to content

Commit

Permalink
fix(tagstore): Allow flag to overwrite logic (#81062)
Browse files Browse the repository at this point in the history
- The existing small # of projects & short date range should not
overwrite the feature flag that samples, since the numeric sample rate
should still work fine for smaller orgs
  • Loading branch information
wmak authored Nov 20, 2024
1 parent 5d39254 commit 5aa14c0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/sentry/tagstore/snuba/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,14 +442,13 @@ def get_tag_keys_for_projects(
organization = Organization.objects.get_from_cache(id=organization_id)
if features.has("organizations:tag-key-sample-n", organization):
optimize_kwargs["sample"] = options.get("visibility.tag-key-sample-size")

# If we are fetching less than max_unsampled_projects, then disable
# the sampling that turbo enables so that we get more accurate results.
# We only want sampling when we have a large number of projects, so
# that we don't cause performance issues for Snuba.
# We also see issues with long timeranges in large projects,
# So only disable sampling if the timerange is short enough.
if len(projects) <= max_unsampled_projects and end - start <= timedelta(days=14):
elif len(projects) <= max_unsampled_projects and end - start <= timedelta(days=14):
optimize_kwargs["sample"] = 1

# Replays doesn't support sampling.
Expand Down

0 comments on commit 5aa14c0

Please sign in to comment.