Skip to content

Commit

Permalink
feat: notif latency with flake detection tag (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-sentry authored Aug 7, 2024
1 parent c3ba63a commit 09db746
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions services/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,15 @@ def latest_test_instances_for_a_given_commit(db_session, commit_id):
)


def should_write_flaky_detection(repoid: int, commit_yaml: UserYaml):
def should_write_flaky_detection(repoid: int, commit_yaml: UserYaml) -> bool:
return (
FLAKY_TEST_DETECTION.check_value(identifier=repoid, default=False)
and read_yaml_field(commit_yaml, ("test_analytics", "flake_detection"), False)
or FLAKY_SHADOW_MODE.check_value(identifier=repoid, default=False)
)


def should_read_flaky_detection(repoid: int, commit_yaml: UserYaml):
def should_read_flaky_detection(repoid: int, commit_yaml: UserYaml) -> bool:
return FLAKY_TEST_DETECTION.check_value(
identifier=repoid, default=False
) and read_yaml_field(commit_yaml, ("test_analytics", "flake_detection"), False)
5 changes: 4 additions & 1 deletion tasks/test_results_finisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ def process_impl_within_lock(
TestResultsFlow.TEST_RESULTS_NOTIFY,
),
unit="millisecond",
tags={"repoid": repoid},
tags={
"repoid": repoid,
"flake_detection": should_read_flaky_detection(repoid, commit_yaml),
},
)
notifier_result: NotifierResult = async_to_sync(notifier.notify)()

Expand Down

0 comments on commit 09db746

Please sign in to comment.