Skip to content

ref(feedback): emit metric instead of outcome for ingest denylist #97970

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 1 addition & 14 deletions src/sentry/feedback/usecases/ingest/shim_to_feedback.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
from __future__ import annotations

import logging
from datetime import datetime
from typing import Any

from sentry.constants import DataCategory
from sentry.feedback.lib.types import UserReportDict
from sentry.feedback.lib.utils import FeedbackCreationSource, is_in_feedback_denylist
from sentry.feedback.usecases.ingest.create_feedback import create_feedback_issue
from sentry.models.project import Project
from sentry.services.eventstore.models import Event, GroupEvent
from sentry.utils import metrics
from sentry.utils.outcomes import Outcome, track_outcome
from sentry.utils.safe import get_path

logger = logging.getLogger(__name__)
Expand All @@ -31,17 +28,7 @@ def shim_to_feedback(
legacy user report and event to create the new feedback.
"""
if is_in_feedback_denylist(project.organization):
track_outcome(
org_id=project.organization_id,
project_id=project.id,
key_id=None,
outcome=Outcome.RATE_LIMITED,
reason="feedback_denylist",
timestamp=datetime.fromisoformat(event.timestamp),
event_id=event.event_id,
category=DataCategory.USER_REPORT_V2,
quantity=1,
)
metrics.incr("feedback.ingest.denylist")
return

try:
Expand Down
13 changes: 2 additions & 11 deletions src/sentry/feedback/usecases/ingest/userreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,8 @@ def save_userreport(
"user_report.create_user_report.filtered",
tags={"reason": "org.denylist", "referrer": source.value},
)
track_outcome(
org_id=project.organization_id,
project_id=project.id,
key_id=None,
outcome=Outcome.RATE_LIMITED,
reason="feedback_denylist",
timestamp=start_time,
event_id=None, # Note report["event_id"] is id of the associated event, not the report itself.
category=DataCategory.USER_REPORT_V2,
quantity=1,
)
metrics.incr("feedback.ingest.denylist")

if (
source == FeedbackCreationSource.USER_REPORT_DJANGO_ENDPOINT
or source == FeedbackCreationSource.CRASH_REPORT_EMBED_FORM
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/ingest/consumer/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def process_event(
project_id=project_id,
)
else:
metrics.incr("feedback.ingest.filtered", tags={"reason": "org.denylist"})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was unused

metrics.incr("feedback.ingest.denylist")
Copy link
Member Author

@aliu39 aliu39 Aug 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - Relay routes feedback events exclusively to the feedback consumer. This condition block is never ran in the ingest consumer

else:
# Preprocess this event, which spawns either process_event or
# save_event. Pass data explicitly to avoid fetching it again from the
Expand Down
3 changes: 3 additions & 0 deletions src/sentry/tasks/update_user_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def update_user_reports(
project,
FeedbackCreationSource.UPDATE_USER_REPORTS_TASK,
)
else:
metrics.incr("feedback.ingest.denylist")

# XXX(aliu): If a report has environment_id but not group_id, this report was shimmed from a feedback issue, so no need to shim again.
report.update(group_id=event.group_id, environment_id=event.get_environment().id)
updated_reports += 1
Expand Down
Loading