Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def query_project_counts_by_org(

Yields chunks of result rows, to allow timeouts to be handled in the caller.
"""
if not org_ids and options.get("dynamic-sampling.skip_snuba_query_for_empty_orgs"):
if not org_ids:
return

if query_interval is None:
Expand Down
7 changes: 0 additions & 7 deletions src/sentry/options/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -2244,13 +2244,6 @@
flags=FLAG_AUTOMATOR_MODIFIABLE,
)

# Skip Snuba query when there are no orgs to query for. This is a rollout flag for a fix
# that prevents unnecessary Snuba queries.
register(
"dynamic-sampling.skip_snuba_query_for_empty_orgs",
default=False,
flags=FLAG_AUTOMATOR_MODIFIABLE,
)

# === Hybrid cloud subsystem options ===
# UI rollout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,17 +377,16 @@ def now(self) -> datetime:
def test_query_skips_for_empty_org_ids_when_option_enabled(self) -> None:
"""
Confirms that query_project_counts_by_org does NOT make a Snuba query
when called with an empty org_ids list and the option is enabled.
when called with an empty org_ids list.
"""
with self.options({"dynamic-sampling.skip_snuba_query_for_empty_orgs": True}):
with patch(
"sentry.dynamic_sampling.tasks.boost_low_volume_projects.raw_snql_query"
) as mock_query:
mock_query.return_value = {"data": []}
with patch(
"sentry.dynamic_sampling.tasks.boost_low_volume_projects.raw_snql_query"
) as mock_query:
mock_query.return_value = {"data": []}

list(query_project_counts_by_org([], SamplingMeasure.TRANSACTIONS))
list(query_project_counts_by_org([], SamplingMeasure.TRANSACTIONS))

assert mock_query.call_count == 0
assert mock_query.call_count == 0

def test_fetch_projects_only_queries_measures_with_orgs(self) -> None:
"""
Expand Down Expand Up @@ -416,7 +415,6 @@ def test_fetch_projects_only_queries_measures_with_orgs(self) -> None:
{
"dynamic-sampling.check_span_feature_flag": True,
"dynamic-sampling.measure.spans": [org.id],
"dynamic-sampling.skip_snuba_query_for_empty_orgs": True,
}
):
partitioned = partition_by_measure([org.id])
Expand Down Expand Up @@ -450,7 +448,6 @@ def test_only_measures_with_orgs_are_queried_per_batch(self) -> None:
{
"dynamic-sampling.check_span_feature_flag": True,
"dynamic-sampling.measure.spans": [org1.id, org2.id],
"dynamic-sampling.skip_snuba_query_for_empty_orgs": True,
}
):
batches = [[org1.id], [org2.id]]
Expand Down
Loading