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

chore(issue assignment): Add logging forGroupOwner auto assignment #45142

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions src/sentry/models/projectownership.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from typing import TYPE_CHECKING, Any, Mapping, Optional, Sequence, Tuple, Union

from django.db import models
Expand All @@ -18,6 +19,8 @@
from sentry.models import ProjectCodeOwners, Team
from sentry.services.hybrid_cloud.user import RpcUser

logger = logging.getLogger(__name__)

READ_CACHE_DURATION = 3600


Expand Down Expand Up @@ -303,6 +306,19 @@ def handle_auto_assignment(cls, project_id, event):
project_id=project_id,
group_id=event.group.id,
)
logger.info(
"handle_auto_assignment.success",
extra={
"event": event.event_id,
"group": event.group_id,
"project": event.project_id,
"organization": event.project.organization_id,
# owner_id returns a string including the owner type (user or team) and id
"assignee": issue_owner.owner_id(),
"reason": "created" if assignment["new_assignment"] else "updated",
**details,
},
)

@classmethod
def _matching_ownership_rules(
Expand Down
7 changes: 7 additions & 0 deletions src/sentry/tasks/post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ def handle_owner_assignment(job):
if issue_owners:
try:
handle_group_owners(project, group, issue_owners)
logger.info(
"handle_owner_assignment.success",
extra={
**basic_logging_details,
"reason": "stored_issue_owners",
},
)
except Exception:
logger.exception("Failed to store group owners")
except Exception:
Expand Down