Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add extra sentry metrics tagged with repoid #528

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion tasks/test_results_finisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ def process_impl_within_lock(

checkpoints.log(TestResultsFlow.TEST_RESULTS_FINISHER_BEGIN)

# TODO: remove this later, we can do this now because there aren't many users using this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have more details about when we should remove this? Should we have a ticket to remind ourselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it depends on the number of unique repos that end up triggering the metrics, the reason we don't want to keep emitting these metrics with the repo tag for too long is because as we get more and more unique repos using this feature the higher the cardinality of the metric will be. At some point it seems the tags will be automatically dropped if their cardinality is too high so this metric will be obsoleted anyways, so we can drop it then.

metrics.distribution(
"test_results_processing_time",
checkpoints._subflow_duration(
TestResultsFlow.TEST_RESULTS_BEGIN,
TestResultsFlow.TEST_RESULTS_FINISHER_BEGIN,
),
unit="millisecond",
tags={"repoid": repoid},
)

commit: Commit = (
db_session.query(Commit).filter_by(repoid=repoid, commitid=commitid).first()
)
Expand Down Expand Up @@ -277,6 +288,16 @@ def process_impl_within_lock(

with metrics.timing("test_results.finisher.notification"):
checkpoints.log(TestResultsFlow.TEST_RESULTS_NOTIFY)
# TODO: remove this later, we can do this now because there aren't many users using this
metrics.distribution(
"test_results_processing_time",
checkpoints._subflow_duration(
TestResultsFlow.TEST_RESULTS_BEGIN,
TestResultsFlow.TEST_RESULTS_NOTIFY,
),
unit="millisecond",
tags={"repoid": repoid},
)
success, reason = async_to_sync(notifier.notify)(payload)

log.info(
Expand Down Expand Up @@ -384,7 +405,18 @@ def run_flaky_test_detection(
db_session.flush()

if checkpoints:
checkpoints.log(TestResultsFlow.TEST_RESULTS_NOTIFY)
checkpoints.log(TestResultsFlow.FLAKE_DETECTION_NOTIFY)

# TODO: remove this later, we can do this now because there aren't many users using this
metrics.distribution(
"test_results_processing_time",
checkpoints._subflow_duration(
TestResultsFlow.TEST_RESULTS_NOTIFY,
TestResultsFlow.FLAKE_DETECTION_NOTIFY,
),
unit="millisecond",
tags={"repoid": repoid},
)
success, reason = async_to_sync(notifier.notify)(payload)
log.info(
"Added flaky test information to the PR comment",
Expand Down
Loading