Skip to content

Commit 874ed3d

Browse files
authored
🔧 chore: add logging for open pr comments query (#95238)
1 parent 743539a commit 874ed3d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/sentry/integrations/source_code_management/commit_context.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,11 +673,15 @@ def get_top_5_issues_by_count_for_file(
673673
self, projects: list[Project], sentry_filenames: list[str], function_names: list[str]
674674
) -> list[dict[str, Any]]:
675675
"""
676-
Given a list of projects, Github filenames reverse-codemapped into filenames in Sentry,
676+
Given a list of projects, filenames reverse-codemapped into filenames in Sentry,
677677
and function names representing the list of functions changed in a PR file, return a
678678
sublist of the top 5 recent unhandled issues ordered by event count.
679679
"""
680680
if not len(projects):
681+
logger.info(
682+
"open_pr_comment.no_projects",
683+
extra={"sentry_filenames": sentry_filenames},
684+
)
681685
return []
682686

683687
patch_parsers = get_patch_parsers_for_organization(projects[0].organization)
@@ -687,6 +691,10 @@ def get_top_5_issues_by_count_for_file(
687691
language_parser = patch_parsers.get(sentry_filenames[0].split(".")[-1], None)
688692

689693
if not language_parser:
694+
logger.info(
695+
"open_pr_comment.no_language_parser",
696+
extra={"sentry_filenames": sentry_filenames},
697+
)
690698
return []
691699

692700
group_ids = list(
@@ -699,6 +707,13 @@ def get_top_5_issues_by_count_for_file(
699707
.order_by("-times_seen")
700708
.values_list("id", flat=True)
701709
)[:OPEN_PR_MAX_RECENT_ISSUES]
710+
711+
if projects[0].organization_id == 1:
712+
logger.info(
713+
"open_pr_comment.length_of_group_ids",
714+
extra={"group_ids_length": len(group_ids)},
715+
)
716+
702717
project_ids = [p.id for p in projects]
703718

704719
multi_if = language_parser.generate_multi_if(function_names)
@@ -799,6 +814,12 @@ def get_top_5_issues_by_count_for_file(
799814
query=query,
800815
)
801816

817+
if projects[0].organization_id == 1:
818+
logger.info(
819+
"open_pr_comment.snuba_query",
820+
extra={"query": request.to_dict()["query"]},
821+
)
822+
802823
try:
803824
return raw_snql_query(request, referrer=self.referrer.value)["data"]
804825
except Exception:

0 commit comments

Comments
 (0)