Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies = [
"mmh3>=4.0.0",
"msgspec>=0.19.0",
"msgpack>=1.1.0",
"objectstore-client>=0.1.1",
"objectstore-client>=0.1.5",
"openai>=1.3.5",
"orjson>=3.10.10",
"p4python>=2025.1.2767466",
Expand Down
29 changes: 25 additions & 4 deletions src/sentry/lang/native/symbolicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,21 @@ def __init__(
self.project = project
self.event_id = event_id

def _process(self, task_name: str, path: str, **kwargs):
def _process(
self,
task_name: str,
path: str,
kwargs_cb: Callable[[], dict[str, Any]] | None = None,
**kwargs: Any,
) -> Any:
"""
This function will submit a symbolication task to a Symbolicator and handle
polling it using the `SymbolicatorSession`.
It will also correctly handle `TaskIdNotFound` and `ServiceUnavailable` errors.

`kwargs_cb`, if provided, is called on every new task submission and its result
is merged over `kwargs`. Use this for values that must be fresh on each
(re)submission, such as expiring tokens.
"""
session = SymbolicatorSession(
url=self.base_url,
Expand All @@ -137,7 +147,8 @@ def _process(self, task_name: str, path: str, **kwargs):
try:
if not task_id:
# We are submitting a new task to Symbolicator
json_response = session.create_task(path, **kwargs)
create_kwargs = {**kwargs, **(kwargs_cb() if kwargs_cb else {})}
json_response = session.create_task(path, **create_kwargs)
else:
# The task has already been submitted to Symbolicator and we are polling
json_response = session.query_task(task_id)
Expand Down Expand Up @@ -201,7 +212,12 @@ def process_minidump(
"rewrite_first_module": rewrite_first_module,
},
}
res = self._process("process_minidump", "symbolicate-any", json=json)

def cb() -> dict[str, Any]:
json["symbolicate"]["storage_token"] = session.mint_token()
return {"json": json}

res = self._process("process_minidump", "symbolicate-any", kwargs_cb=cb)
return process_response(res)

data = {
Expand Down Expand Up @@ -233,7 +249,12 @@ def process_applecrashreport(self, platform: str, report: CachedAttachment):
"storage_url": storage_url,
},
}
res = self._process("process_applecrashreport", "symbolicate-any", json=json)

def cb() -> dict[str, Any]:
json["symbolicate"]["storage_token"] = session.mint_token()
return {"json": json}

res = self._process("process_applecrashreport", "symbolicate-any", kwargs_cb=cb)
return process_response(res)

data = {
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading