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(auto_source_config): Pass group_id to avoid Snuba call #83650

Merged
merged 11 commits into from
Jan 20, 2025

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Jan 17, 2025

In #83475 we started passing the event_id instead of the Node data to prevent passing pickled data.

Unfortunately, that causes an extra Snuba call (which can fail) to determine the group ID.

If we pass the group_id when scheduling the task we won't need to call Snuba.

Fixes SENTRY-3MGG

In #83475 we started passing the `event_id` instead of the Node data to prevent passing pickled data.

Unfortunately, that causes a Snuba call in order to determine the group ID.

If we pass the group_id when scheduling the task we won't need to call Snuba.
@armenzg armenzg self-assigned this Jan 17, 2025
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 17, 2025
@armenzg armenzg marked this pull request as ready for review January 17, 2025 16:05
@armenzg armenzg requested a review from a team as a code owner January 17, 2025 16:05
@armenzg armenzg requested a review from wedamija January 17, 2025 16:07
@JoshFerge
Copy link
Member

where do we actually use the group_id that's passed in? or is that to be done in a future PR

@armenzg armenzg requested review from a team as code owners January 17, 2025 16:16
"event_id": event_id,
}

event = eventstore.backend.get_event_by_id(project_id, event_id, group_id=group_id)
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 is the actual fix.

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 95.23810% with 2 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/tasks/auto_source_code_config.py 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #83650      +/-   ##
==========================================
- Coverage   87.63%   87.59%   -0.04%     
==========================================
  Files        9490     9492       +2     
  Lines      541208   539139    -2069     
  Branches    21232    21180      -52     
==========================================
- Hits       474272   472278    -1994     
+ Misses      66588    66516      -72     
+ Partials      348      345       -3     

@armenzg armenzg disabled auto-merge January 17, 2025 17:21
@armenzg armenzg requested a review from wedamija January 17, 2025 17:25
@@ -85,27 +85,34 @@ def process_error(error: ApiError, extra: dict[str, str]) -> None:
default_retry_delay=60 * 10,
max_retries=3,
)
def auto_source_code_config(project_id: int, event_id: str, **kwargs: Any) -> None:
def auto_source_code_config(
project_id: int, event_id: str, group_id: int | None = None, **kwargs: Any
Copy link
Member Author

Choose a reason for hiding this comment

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

@wedamija Made it optional.

extra = {
"organization.slug": org.slug,
"project_id": project_id,
"group_id": group_id,
Copy link
Member

@JoshFerge JoshFerge Jan 17, 2025

Choose a reason for hiding this comment

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

do you have to access it using kwargs["group_id"] too? or is making it optional in the signature enough?

Copy link
Member Author

Choose a reason for hiding this comment

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

Let us not find out the wrong way.
I have changed it to None by default.

Copy link
Member

Choose a reason for hiding this comment

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

It's fine to have it in the signature with = None

extra = {
"organization.slug": org.slug,
"project_id": project_id,
"group_id": group_id,
Copy link
Member

Choose a reason for hiding this comment

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

It's fine to have it in the signature with = None

@@ -1017,7 +1017,7 @@ def process_code_mappings(job: PostProcessJob) -> None:
else:
return

auto_source_code_config.delay(project.id, event_id=event.event_id)
auto_source_code_config.delay(project.id, event_id=event.event_id, group_id=group_id)
Copy link
Member

Choose a reason for hiding this comment

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

Just make sure that the **kwargs in the definition is already deployed before this deploys. I assume it is, just want to be doubly sure

@armenzg armenzg enabled auto-merge (squash) January 20, 2025 15:30
@armenzg armenzg merged commit 3c67c98 into master Jan 20, 2025
48 checks passed
@armenzg armenzg deleted the do_not_call_snuba/auto_source_config/armenzg branch January 20, 2025 15:57
andrewshie-sentry pushed a commit that referenced this pull request Jan 22, 2025
In #83475 we started passing the `event_id` instead of the Node data to
prevent passing pickled data.

Unfortunately, that causes an extra Snuba call (which can fail) to
determine the group ID.

If we pass the group_id when scheduling the task we won't need to call
Snuba.

Fixes [SENTRY-3MGG](https://sentry.sentry.io/issues/6222497528/)
Copy link

sentry-io bot commented Jan 28, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ SnubaError: HTTPConnectionPool(host='127.0.0.1', port=10006): Max retries exceeded with url: /events/snql (Ca... sentry.tasks.auto_source_code_config View Issue

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants