-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(auto_source_config): Pass group_id to avoid Snuba call #83650
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
Changes from all commits
22a9f23
31c724f
a3053c3
fb34b0d
eb830a0
9d1bc27
529d8f6
461d929
1d02365
5ab7e4f
8416de5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ class DeriveCodeMappingsErrorReason(StrEnum): | |
EMPTY_TREES = "The trees are empty." | ||
|
||
|
||
def process_error(error: ApiError, extra: dict[str, str]) -> None: | ||
def process_error(error: ApiError, extra: dict[str, Any]) -> None: | ||
"""Log known issues and report unknown ones""" | ||
if error.json: | ||
json_data: Any = error.json | ||
|
@@ -85,27 +85,37 @@ 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 | ||
) -> None: | ||
""" | ||
Process errors for customers with source code management installed and calculate code mappings | ||
among other things. | ||
|
||
This task is queued at most once per hour per project. | ||
""" | ||
project = Project.objects.get(id=project_id) | ||
org: Organization = Organization.objects.get(id=project.organization_id) | ||
org = Organization.objects.get(id=project.organization_id) | ||
set_tag("organization.slug", org.slug) | ||
# When you look at the performance page the user is a default column | ||
set_user({"username": org.slug}) | ||
set_tag("project.slug", project.slug) | ||
extra: dict[str, Any] = {"organization.slug": org.slug, "event_id": event_id} | ||
|
||
event = eventstore.backend.get_event_by_id(project_id, event_id) | ||
extra = { | ||
"organization.slug": org.slug, | ||
"project_id": project_id, | ||
"group_id": group_id, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you have to access it using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let us not find out the wrong way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine to have it in the signature with |
||
"event_id": event_id, | ||
} | ||
|
||
if group_id is None: | ||
event = eventstore.backend.get_event_by_id(project_id, event_id) | ||
else: | ||
event = eventstore.backend.get_event_by_id(project_id, event_id, group_id) | ||
if event is None: | ||
logger.error("Event not found.", extra={"project_id": project_id, "event_id": event_id}) | ||
logger.error("Event not found.", extra=extra) | ||
return | ||
|
||
stacktrace_paths: list[str] = identify_stacktrace_paths(event.data) | ||
stacktrace_paths = identify_stacktrace_paths(event.data) | ||
if not stacktrace_paths: | ||
logger.info("No stacktrace paths found.", extra=extra) | ||
return | ||
|
@@ -133,7 +143,7 @@ def auto_source_code_config(project_id: int, event_id: str, **kwargs: Any) -> No | |
lifecycle.record_halt(error, extra) | ||
return | ||
except UnableToAcquireLock as error: | ||
extra["error"] = error | ||
extra["error"] = str(error) | ||
lifecycle.record_failure(error, extra) | ||
return | ||
except Exception: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just make sure that the |
||
|
||
except Exception: | ||
logger.exception("Failed to process automatic source code config") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wedamija Made it optional.