Skip to content

Commit 22ec07c

Browse files
committed
can't use record_event
1 parent dbd9fd3 commit 22ec07c

File tree

1 file changed

+11
-26
lines changed

1 file changed

+11
-26
lines changed

src/sentry/integrations/source_code_management/commit_context.py

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from sentry.models.group import Group
2424
from sentry.models.groupowner import GroupOwner
2525
from sentry.models.options.organization_option import OrganizationOption
26-
from sentry.models.organization import Organization
2726
from sentry.models.project import Project
2827
from sentry.models.pullrequest import (
2928
CommentType,
@@ -93,25 +92,6 @@ def integration_name(self) -> str:
9392
def get_client(self) -> CommitContextClient:
9493
raise NotImplementedError
9594

96-
def record_event(
97-
self,
98-
event: SCMIntegrationInteractionType,
99-
organization: Organization | None = None,
100-
project: Project | None = None,
101-
commit: Commit | None = None,
102-
repository: Repository | None = None,
103-
pull_request: PullRequest | None = None,
104-
):
105-
return CommitContextIntegrationInteractionEvent(
106-
interaction_type=event,
107-
provider_key=self.integration_name,
108-
organization=organization,
109-
project=project,
110-
commit=commit,
111-
repository=repository,
112-
pull_request=pull_request,
113-
)
114-
11595
def get_blame_for_files(
11696
self, files: Sequence[SourceLineInfo], extra: Mapping[str, Any]
11797
) -> list[FileBlameInfo]:
@@ -120,8 +100,9 @@ def get_blame_for_files(
120100
121101
files: list of FileBlameInfo objects
122102
"""
123-
with self.record_event(
124-
SCMIntegrationInteractionType.GET_BLAME_FOR_FILES
103+
with CommitContextIntegrationInteractionEvent(
104+
interaction_type=SCMIntegrationInteractionType.GET_BLAME_FOR_FILES,
105+
provider_key=self.integration_name,
125106
).capture() as lifecycle:
126107
try:
127108
client = self.get_client()
@@ -155,8 +136,9 @@ def queue_comment_task_if_needed(
155136
group_owner: GroupOwner,
156137
group_id: int,
157138
) -> None:
158-
with self.record_event(
159-
SCMIntegrationInteractionType.QUEUE_COMMENT_TASK,
139+
with CommitContextIntegrationInteractionEvent(
140+
interaction_type=SCMIntegrationInteractionType.QUEUE_COMMENT_TASK,
141+
provider_key=self.integration_name,
160142
organization=project.organization,
161143
project=project,
162144
commit=commit,
@@ -311,8 +293,11 @@ def create_or_update_comment(
311293
else SCMIntegrationInteractionType.UPDATE_COMMENT
312294
)
313295

314-
with self.record_event(
315-
interaction_type, repository=repo, pull_request_id=pullrequest_id
296+
with CommitContextIntegrationInteractionEvent(
297+
interaction_type=interaction_type,
298+
provider_key=self.integration_name,
299+
repository=repo,
300+
pull_request_id=pullrequest_id,
316301
).capture():
317302
if pr_comment is None:
318303
resp = client.create_comment(

0 commit comments

Comments
 (0)