Skip to content

Commit cf3f63b

Browse files
authored
feat(symbolicator): pass objectstore token to symbolicator (#112058)
pass an objectstore token to symbolicator alongside minidump/applecrashreport attachment URLs NOTE: token expiry time is set in the global client and shared across usecases/sessions. the default value is 60s.
1 parent ad40621 commit cf3f63b

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies = [
5353
"mmh3>=4.0.0",
5454
"msgspec>=0.19.0",
5555
"msgpack>=1.1.0",
56-
"objectstore-client>=0.1.1",
56+
"objectstore-client>=0.1.5",
5757
"openai>=1.3.5",
5858
"orjson>=3.10.10",
5959
"p4python>=2025.1.2767466",

src/sentry/lang/native/symbolicator.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,21 @@ def __init__(
114114
self.project = project
115115
self.event_id = event_id
116116

117-
def _process(self, task_name: str, path: str, **kwargs):
117+
def _process(
118+
self,
119+
task_name: str,
120+
path: str,
121+
kwargs_cb: Callable[[], dict[str, Any]] | None = None,
122+
**kwargs: Any,
123+
) -> Any:
118124
"""
119125
This function will submit a symbolication task to a Symbolicator and handle
120126
polling it using the `SymbolicatorSession`.
121127
It will also correctly handle `TaskIdNotFound` and `ServiceUnavailable` errors.
128+
129+
`kwargs_cb`, if provided, is called on every new task submission and its result
130+
is merged over `kwargs`. Use this for values that must be fresh on each
131+
(re)submission, such as expiring tokens.
122132
"""
123133
session = SymbolicatorSession(
124134
url=self.base_url,
@@ -137,7 +147,8 @@ def _process(self, task_name: str, path: str, **kwargs):
137147
try:
138148
if not task_id:
139149
# We are submitting a new task to Symbolicator
140-
json_response = session.create_task(path, **kwargs)
150+
create_kwargs = {**kwargs, **(kwargs_cb() if kwargs_cb else {})}
151+
json_response = session.create_task(path, **create_kwargs)
141152
else:
142153
# The task has already been submitted to Symbolicator and we are polling
143154
json_response = session.query_task(task_id)
@@ -201,7 +212,12 @@ def process_minidump(
201212
"rewrite_first_module": rewrite_first_module,
202213
},
203214
}
204-
res = self._process("process_minidump", "symbolicate-any", json=json)
215+
216+
def cb() -> dict[str, Any]:
217+
json["symbolicate"]["storage_token"] = session.mint_token()
218+
return {"json": json}
219+
220+
res = self._process("process_minidump", "symbolicate-any", kwargs_cb=cb)
205221
return process_response(res)
206222

207223
data = {
@@ -233,7 +249,12 @@ def process_applecrashreport(self, platform: str, report: CachedAttachment):
233249
"storage_url": storage_url,
234250
},
235251
}
236-
res = self._process("process_applecrashreport", "symbolicate-any", json=json)
252+
253+
def cb() -> dict[str, Any]:
254+
json["symbolicate"]["storage_token"] = session.mint_token()
255+
return {"json": json}
256+
257+
res = self._process("process_applecrashreport", "symbolicate-any", kwargs_cb=cb)
237258
return process_response(res)
238259

239260
data = {

uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)