From aeefd284ee01bc2075d92a5a7817a2bbd853be3d Mon Sep 17 00:00:00 2001 From: Andrii Soldatenko Date: Wed, 22 Feb 2023 09:26:25 +0100 Subject: [PATCH 1/4] feat: add new bias toggle to project details for prioritise by tx name --- src/sentry/dynamic_sampling/rules/utils.py | 3 +++ tests/sentry/api/endpoints/test_project_details.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/sentry/dynamic_sampling/rules/utils.py b/src/sentry/dynamic_sampling/rules/utils.py index 1f752655f845..cffbcb1a7d53 100644 --- a/src/sentry/dynamic_sampling/rules/utils.py +++ b/src/sentry/dynamic_sampling/rules/utils.py @@ -31,6 +31,7 @@ class RuleType(Enum): BOOST_LATEST_RELEASES_RULE = "boostLatestRelease" IGNORE_HEALTH_CHECKS_RULE = "ignoreHealthChecks" BOOST_KEY_TRANSACTIONS_RULE = "boostKeyTransactions" + PRIORITISE_BY_TX_NAME_RULE = "prioritiseByTxName" DEFAULT_BIASES: List[ActivatableBias] = [ @@ -41,12 +42,14 @@ class RuleType(Enum): }, {"id": RuleType.IGNORE_HEALTH_CHECKS_RULE.value, "active": True}, {"id": RuleType.BOOST_KEY_TRANSACTIONS_RULE.value, "active": True}, + {"id": RuleType.PRIORITISE_BY_TX_NAME_RULE.value, "active": False}, ] RESERVED_IDS = { RuleType.UNIFORM_RULE: 1000, RuleType.BOOST_ENVIRONMENTS_RULE: 1001, RuleType.IGNORE_HEALTH_CHECKS_RULE: 1002, RuleType.BOOST_KEY_TRANSACTIONS_RULE: 1003, + RuleType.PRIORITISE_BY_TX_NAME_RULE: 1400, RuleType.BOOST_LATEST_RELEASES_RULE: 1500, } REVERSE_RESERVED_IDS = {value: key for key, value in RESERVED_IDS.items()} diff --git a/tests/sentry/api/endpoints/test_project_details.py b/tests/sentry/api/endpoints/test_project_details.py index 0ebfad6315a1..02395b6b022e 100644 --- a/tests/sentry/api/endpoints/test_project_details.py +++ b/tests/sentry/api/endpoints/test_project_details.py @@ -1325,6 +1325,7 @@ def test_get_dynamic_sampling_biases_manually_set_biases(self): }, {"id": "ignoreHealthChecks", "active": True}, {"id": "boostKeyTransactions", "active": True}, + {"id": "prioritiseByTxName", "active": False}, ] def test_get_dynamic_sampling_biases_with_previously_assigned_biases(self): @@ -1351,6 +1352,7 @@ def test_get_dynamic_sampling_biases_with_previously_assigned_biases(self): }, {"id": "ignoreHealthChecks", "active": True}, {"id": "boostKeyTransactions", "active": True}, + {"id": "prioritiseByTxName", "active": False}, ] def test_dynamic_sampling_bias_activation(self): @@ -1468,6 +1470,7 @@ def test_put_new_dynamic_sampling_rules_with_correct_flags(self): }, {"id": "ignoreHealthChecks", "active": False}, {"id": "boostKeyTransactions", "active": False}, + {"id": "prioritiseByTxName", "active": False}, ] with Feature( { From 06f24bb24c151724002d72d7c03cc61a3728c70a Mon Sep 17 00:00:00 2001 From: Andrii Soldatenko Date: Thu, 23 Feb 2023 15:38:23 +0100 Subject: [PATCH 2/4] rename to BOOST_LOW_VOLUME_TRANSACTIONS --- src/sentry/dynamic_sampling/rules/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sentry/dynamic_sampling/rules/utils.py b/src/sentry/dynamic_sampling/rules/utils.py index cffbcb1a7d53..c6643f3b93ab 100644 --- a/src/sentry/dynamic_sampling/rules/utils.py +++ b/src/sentry/dynamic_sampling/rules/utils.py @@ -31,7 +31,7 @@ class RuleType(Enum): BOOST_LATEST_RELEASES_RULE = "boostLatestRelease" IGNORE_HEALTH_CHECKS_RULE = "ignoreHealthChecks" BOOST_KEY_TRANSACTIONS_RULE = "boostKeyTransactions" - PRIORITISE_BY_TX_NAME_RULE = "prioritiseByTxName" + BOOST_LOW_VOLUME_TRANSACTIONS = "boostLowVolumeTransactions" DEFAULT_BIASES: List[ActivatableBias] = [ @@ -42,14 +42,14 @@ class RuleType(Enum): }, {"id": RuleType.IGNORE_HEALTH_CHECKS_RULE.value, "active": True}, {"id": RuleType.BOOST_KEY_TRANSACTIONS_RULE.value, "active": True}, - {"id": RuleType.PRIORITISE_BY_TX_NAME_RULE.value, "active": False}, + {"id": RuleType.BOOST_LOW_VOLUME_TRANSACTIONS.value, "active": False}, ] RESERVED_IDS = { RuleType.UNIFORM_RULE: 1000, RuleType.BOOST_ENVIRONMENTS_RULE: 1001, RuleType.IGNORE_HEALTH_CHECKS_RULE: 1002, RuleType.BOOST_KEY_TRANSACTIONS_RULE: 1003, - RuleType.PRIORITISE_BY_TX_NAME_RULE: 1400, + RuleType.BOOST_LOW_VOLUME_TRANSACTIONS: 1400, RuleType.BOOST_LATEST_RELEASES_RULE: 1500, } REVERSE_RESERVED_IDS = {value: key for key, value in RESERVED_IDS.items()} From 3ab134542abdefe481e26a747b7d40e8d14162c4 Mon Sep 17 00:00:00 2001 From: Andrii Soldatenko Date: Thu, 23 Feb 2023 16:20:36 +0100 Subject: [PATCH 3/4] Update tests/sentry/api/endpoints/test_project_details.py Co-authored-by: Radu Woinaroski <5281987+RaduW@users.noreply.github.com> --- tests/sentry/api/endpoints/test_project_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sentry/api/endpoints/test_project_details.py b/tests/sentry/api/endpoints/test_project_details.py index 02395b6b022e..1f91e3c70a9d 100644 --- a/tests/sentry/api/endpoints/test_project_details.py +++ b/tests/sentry/api/endpoints/test_project_details.py @@ -1325,7 +1325,7 @@ def test_get_dynamic_sampling_biases_manually_set_biases(self): }, {"id": "ignoreHealthChecks", "active": True}, {"id": "boostKeyTransactions", "active": True}, - {"id": "prioritiseByTxName", "active": False}, + {"id": "boostLowVolumeTransactions", "active": False}, ] def test_get_dynamic_sampling_biases_with_previously_assigned_biases(self): From b064f9c453f2c3b81bc8b87e1d14f5d73eb726a2 Mon Sep 17 00:00:00 2001 From: Andrii Soldatenko Date: Mon, 27 Feb 2023 09:33:55 +0100 Subject: [PATCH 4/4] fix tests --- tests/sentry/api/endpoints/test_project_details.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sentry/api/endpoints/test_project_details.py b/tests/sentry/api/endpoints/test_project_details.py index 1f91e3c70a9d..b3f7ff4b6124 100644 --- a/tests/sentry/api/endpoints/test_project_details.py +++ b/tests/sentry/api/endpoints/test_project_details.py @@ -1352,7 +1352,7 @@ def test_get_dynamic_sampling_biases_with_previously_assigned_biases(self): }, {"id": "ignoreHealthChecks", "active": True}, {"id": "boostKeyTransactions", "active": True}, - {"id": "prioritiseByTxName", "active": False}, + {"id": "boostLowVolumeTransactions", "active": False}, ] def test_dynamic_sampling_bias_activation(self): @@ -1470,7 +1470,7 @@ def test_put_new_dynamic_sampling_rules_with_correct_flags(self): }, {"id": "ignoreHealthChecks", "active": False}, {"id": "boostKeyTransactions", "active": False}, - {"id": "prioritiseByTxName", "active": False}, + {"id": "boostLowVolumeTransactions", "active": False}, ] with Feature( {