From e96d0950e12b65025c40371f520242c494272708 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:58:23 -0700 Subject: [PATCH] chore(feedback): additional metrics for celery task and shim_to_feedback errors (#76750) Gives us visibility on effectiveness+failures of update_user_reports task, and shim failures --- src/sentry/feedback/usecases/create_feedback.py | 1 + src/sentry/tasks/update_user_reports.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/sentry/feedback/usecases/create_feedback.py b/src/sentry/feedback/usecases/create_feedback.py index 35b25418df5860..1c6fc58b21d958 100644 --- a/src/sentry/feedback/usecases/create_feedback.py +++ b/src/sentry/feedback/usecases/create_feedback.py @@ -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): diff --git a/src/sentry/tasks/update_user_reports.py b/src/sentry/tasks/update_user_reports.py index ecdbe4190c6d4f..cba96e82f15722 100644 --- a/src/sentry/tasks/update_user_reports.py +++ b/src/sentry/tasks/update_user_reports.py @@ -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__) @@ -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) @@ -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, @@ -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 = {