Skip to content

Commit 6045011

Browse files
authored
🔧 chore: add logging for project transfers (#93779)
1 parent 05bbd37 commit 6045011

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/sentry/api/endpoints/accept_project_transfer.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import logging
2+
13
from django.core.signing import BadSignature, SignatureExpired
24
from django.http import Http404
35
from django.utils.encoding import force_str
@@ -23,6 +25,8 @@
2325
from sentry.utils import metrics
2426
from sentry.utils.signing import unsign
2527

28+
logger = logging.getLogger(__name__)
29+
2630

2731
class InvalidPayload(Exception):
2832
pass
@@ -144,12 +148,25 @@ def post(self, request: Request) -> Response:
144148
sender=self,
145149
)
146150

151+
logger.info(
152+
"project_transferred",
153+
extra={
154+
"old_organization_id": old_organization.id,
155+
"new_organization_id": organization.id,
156+
"project_id": project.id,
157+
},
158+
)
159+
147160
self.create_audit_entry(
148161
request=request,
149162
organization=project.organization,
150163
target_object=project.id,
151164
event=audit_log.get_event_id("PROJECT_ACCEPT_TRANSFER"),
152-
data=project.get_audit_log_data(),
165+
data={
166+
"old_organization_slug": old_organization.slug,
167+
"new_organization_slug": organization.slug,
168+
"project_slug": project.slug,
169+
},
153170
transaction_id=transaction_id,
154171
)
155172

src/sentry/audit_log/register.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
event_id=36,
101101
name="PROJECT_ACCEPT_TRANSFER",
102102
api_name="project.accept-transfer",
103-
template="accepted transfer of project {slug}",
103+
template="accepted transfer of project {project_slug} from {old_organization_slug} to {new_organization_slug}",
104104
)
105105
)
106106
default_manager.add(events.ProjectEnableAuditLogEvent())

0 commit comments

Comments
 (0)