From a56d65bf86971848c9543baf1481aca72e595451 Mon Sep 17 00:00:00 2001 From: Andrii Soldatenko Date: Tue, 28 Feb 2023 13:24:24 +0100 Subject: [PATCH] feat(dyn-sampling): add new bias toggle to project details for prioritise by tx name [TET-717] (#44944) This PR adds new toggle for project details for prioritise by tx name Tested locally: image --------- Co-authored-by: Priscila Oliveira Co-authored-by: Radu Woinaroski <5281987+RaduW@users.noreply.github.com> --- 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 1f752655f845df..c6643f3b93ab60 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" + BOOST_LOW_VOLUME_TRANSACTIONS = "boostLowVolumeTransactions" 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.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.BOOST_LOW_VOLUME_TRANSACTIONS: 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 0ebfad6315a1ed..b3f7ff4b6124a8 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": "boostLowVolumeTransactions", "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": "boostLowVolumeTransactions", "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": "boostLowVolumeTransactions", "active": False}, ] with Feature( {