Skip to content

Commit

Permalink
feat(dyn-sampling): add new bias toggle to project details for priori…
Browse files Browse the repository at this point in the history
…tise by tx name [TET-717] (#44944)

This PR adds new toggle for project details for prioritise by tx name


Tested locally:

<img width="758" alt="image"
src="https://user-images.githubusercontent.com/1374633/220940820-5cd7f09a-dc69-439a-8742-540f1e5b9770.png">

---------

Co-authored-by: Priscila Oliveira <[email protected]>
Co-authored-by: Radu Woinaroski <[email protected]>
  • Loading branch information
3 people authored Feb 28, 2023
1 parent a4a6c4a commit a56d65b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sentry/dynamic_sampling/rules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = [
Expand All @@ -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()}
Expand Down
3 changes: 3 additions & 0 deletions tests/sentry/api/endpoints/test_project_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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(
{
Expand Down

0 comments on commit a56d65b

Please sign in to comment.