Skip to content

Commit 4055e66

Browse files
authored
debug: add log and trace for impacted file (#810)
1 parent ff2e8dd commit 4055e66

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

graphql_api/types/comparison/comparison.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from asyncio import gather
22
from typing import List, Optional
33

4+
import sentry_sdk
45
from ariadne import ObjectType, UnionType, convert_kwargs_to_snake_case
56
from graphql.type.definition import GraphQLResolveInfo
67

@@ -237,6 +238,7 @@ def resolve_flag_comparisons_count(
237238
return get_flag_comparisons(comparison.commit_comparison).count()
238239

239240

241+
@sentry_sdk.trace
240242
@comparison_bindable.field("hasDifferentNumberOfHeadAndBaseReports")
241243
@sync_to_async
242244
def resolve_has_different_number_of_head_and_base_reports(

graphql_api/types/impacted_file/impacted_file.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import hashlib
22
from typing import List, Union
33

4+
import sentry_sdk
45
from ariadne import ObjectType, UnionType, convert_kwargs_to_snake_case
56
from shared.reports.types import ReportTotals
67
from shared.torngit.exceptions import TorngitClientError
@@ -63,6 +64,7 @@ def resolve_hashed_path(impacted_file: ImpactedFile, info) -> str:
6364
return md5_path.hexdigest()
6465

6566

67+
@sentry_sdk.trace
6668
@impacted_file_bindable.field("segments")
6769
@sync_to_async
6870
@convert_kwargs_to_snake_case

services/comparison.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,12 @@ def head_report(self):
721721

722722
@cached_property
723723
def has_different_number_of_head_and_base_sessions(self):
724+
log.info("has_different_number_of_head_and_base_sessions - Start")
724725
head_sessions = self.head_report.sessions
725726
base_sessions = self.base_report.sessions
727+
log.info(
728+
f"has_different_number_of_head_and_base_sessions - Retrieved sessions - head {len(head_sessions)} / base {len(base_sessions)}"
729+
)
726730
# We're treating this case as false since considering CFF's complicates the logic
727731
if self._has_cff_sessions(head_sessions) or self._has_cff_sessions(
728732
base_sessions
@@ -733,10 +737,12 @@ def has_different_number_of_head_and_base_sessions(self):
733737
# I feel this method should belong to the API Report class, but we're thinking of getting rid of that class soon
734738
# In truth, this should be in the shared.Report class
735739
def _has_cff_sessions(self, sessions) -> bool:
740+
log.info(f"_has_cff_sessions - sessions count {len(sessions)}")
736741
for session in sessions.values():
737742
if session.session_type.value == "carriedforward":
743+
log.info("_has_cff_sessions - Found carriedforward")
738744
return True
739-
745+
log.info("_has_cff_sessions - No carriedforward")
740746
return False
741747

742748
@property

0 commit comments

Comments
 (0)