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

fix(feedback): enforce a max message size from all sources #79326

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

aliu39
Copy link
Member

@aliu39 aliu39 commented Oct 17, 2024

Closes #76298
Closes SENTRY-3B86

Decided on a limit of 4096, generously below the LLM request, postgres, and kafka size limits described in the ticket. Messages that are too large will be truncated (or rejected, for crash report modal) and skip spam detection, auto-marking as spam.

Includes a small refactor of create_feedback.py, moving stuff around and commenting a bit. Renamed auto_ignore_spam_feedback to set_feedback_ignored.

@aliu39 aliu39 changed the title Truncate large msgs in create_feedback and skip spam detection. +some refactoring fix(feedback): enforce a max message size from all sources Oct 17, 2024
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 17, 2024
@aliu39 aliu39 marked this pull request as ready for review October 17, 2024 23:09
@aliu39 aliu39 requested review from a team as code owners October 17, 2024 23:09
@aliu39 aliu39 requested a review from JoshFerge October 17, 2024 23:10
tags={
"is_spam": is_message_spam,
"pow2_size_bucket": 2 ** math.ceil(math.log2(len(feedback_message))),
Copy link
Member Author

Choose a reason for hiding this comment

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

Limits the granularity of this tag. I'd rather do this for viewing in datadog, instead of logging each msg size.

Copy link
Member

@JoshFerge JoshFerge Oct 18, 2024

Choose a reason for hiding this comment

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

cant we just use a distribution metric type?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, yes!

@aliu39 aliu39 requested a review from a team as a code owner October 17, 2024 23:34
Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/0778_userreport_comments_max_length.py ()

--
-- Alter field comments on userreport
--
-- (no-op)

Copy link
Member

@wedamija wedamija left a comment

Choose a reason for hiding this comment

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

Migration lgtm

metrics.incr(
"feedback.large_message",
tags={
"pow2_size_bucket": 2 ** math.ceil(math.log2(len(report["comments"]))),
Copy link
Member

Choose a reason for hiding this comment

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

same here. can we just make it a distribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UF Backend: Limit feedback message size
3 participants