Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Soldatenko committed Feb 7, 2023
1 parent 95b7f09 commit 015522e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/sentry/dynamic_sampling/prioritise_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def fetch_projects_with_total_volumes() -> Mapping[int, Sequence[int]]:
while (time.time() - start_time) < MAX_SECONDS:
query = (
Query(
match=Entity(EntityKey.OrgMetricsCounters.value),
match=Entity(EntityKey.GenericMetricsCounters.value),
select=[
Column("org_id"),
Column("project_id"),
Expand All @@ -47,10 +47,12 @@ def fetch_projects_with_total_volumes() -> Mapping[int, Sequence[int]]:
.set_limit(CHUNK_SIZE + 1)
.set_offset(offset)
)
request = Request(dataset=Dataset.Metrics.value, app_id="dynamic_sampling", query=query)
request = Request(
dataset=Dataset.PerformanceMetrics.value, app_id="dynamic_sampling", query=query
)
data = raw_snql_query(
request,
referrer="dynamic_sampling.fetch_projects_with_total_volumes",
referrer="dynamic_sampling.fetch_projects_with_count_per_root_total_volumes",
)["data"]
count = len(data)
more_results = count > CHUNK_SIZE
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/dynamic_sampling/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def process_projects_sample_rates(org_id, project_ids) -> None:

# Get adjusted sample rate via adjustment model
#
# prioritize_projects.delay(org_id, project_ids)
# prioritise_projects.delay(org_id, project_ids)
1 change: 1 addition & 0 deletions src/sentry/snuba/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ class EntityKey(Enum):
MetricsDistributions = "metrics_distributions"
GenericMetricsDistributions = "generic_metrics_distributions"
GenericMetricsSets = "generic_metrics_sets"
GenericMetricsCounters = "generic_metrics_counters"
IssuePlatform = "search_issues"
9 changes: 7 additions & 2 deletions tests/sentry/dynamic_sampling/test_prioritise_projects.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import pytest

from sentry.dynamic_sampling.prioritise_projects import fetch_projects_with_total_volumes
from sentry.testutils.factories import Factories


@pytest.mark.django_db
def test_prioritize_projects():
results = fetch_projects_with_total_volumes()
1 == 1
organization = Factories.create_organization(name="test-org")
Factories.create_project(organization=organization)
fetch_projects_with_total_volumes()

0 comments on commit 015522e

Please sign in to comment.