Skip to content

Commit

Permalink
chore(feedback): additional metrics for celery task and shim_to_feedb…
Browse files Browse the repository at this point in the history
…ack errors (#76750)

Gives us visibility on effectiveness+failures of update_user_reports
task, and shim failures
  • Loading branch information
aliu39 authored Aug 29, 2024
1 parent 428b173 commit e96d095
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sentry/feedback/usecases/create_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ def shim_to_feedback(
logger.exception(
"Error attempting to create new User Feedback from Shiming old User Report"
)
metrics.incr("feedback.shim_to_feedback.failed", tags={"referrer": source.value})


def auto_ignore_spam_feedbacks(project, issue_fingerprint):
Expand Down
4 changes: 4 additions & 0 deletions src/sentry/tasks/update_user_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from sentry.models.userreport import UserReport
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task
from sentry.utils import metrics
from sentry.utils.iterators import chunked

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -71,6 +72,7 @@ def update_user_reports(**kwargs: Any) -> None:
"update_user_reports.eventstore_query_failed",
extra={"project_id": project_id, "start": start, "end": end},
) # will also send exc to Sentry
metrics.incr("tasks.update_user_reports.eventstore_query_failed")

for event in events:
report = report_by_event.get(event.event_id)
Expand All @@ -82,6 +84,7 @@ def update_user_reports(**kwargs: Any) -> None:
"update_user_reports.shim_to_feedback",
extra={"report_id": report.id, "event_id": event.event_id},
)
metrics.incr("tasks.update_user_reports.shim_to_feedback")
shim_to_feedback(
{
"name": report.name,
Expand All @@ -96,6 +99,7 @@ def update_user_reports(**kwargs: Any) -> None:
)
report.update(group_id=event.group_id, environment_id=event.get_environment().id)
updated_reports += 1
metrics.incr("tasks.update_user_reports.missing_event_found")

if not samples and len(reports) <= 10:
samples = {
Expand Down

0 comments on commit e96d095

Please sign in to comment.