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

feat: Process scraping_attempts sent by Symbolicator #57461

Merged
merged 1 commit into from
Oct 4, 2023
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
3 changes: 3 additions & 0 deletions src/sentry/lang/javascript/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def process_js_stacktraces(symbolicator: Symbolicator, data: Any) -> Any:
processing_errors = response.get("errors", [])
if len(processing_errors) > 0:
data.setdefault("errors", []).extend(map_symbolicator_process_js_errors(processing_errors))
scraping_attempts = response.get("scraping_attempts", [])
if len(scraping_attempts) > 0:
data["scraping_attempts"] = scraping_attempts

assert len(stacktraces) == len(response["stacktraces"]), (stacktraces, response)

Expand Down
30 changes: 30 additions & 0 deletions tests/relay_integration/lang/javascript/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ def test_sourcemap_source_expansion(self):
}
]

assert event.data["scraping_attempts"] == [
{"status": "not_attempted", "url": "http://example.com/file.min.js"},
{"status": "not_attempted", "url": "http://example.com/file.sourcemap.js"},
{"status": "not_attempted", "url": "http://example.com/file1.js"},
]

exception = event.interfaces["exception"]
frame_list = exception.values[0].stacktrace.frames

Expand Down Expand Up @@ -468,6 +474,13 @@ def test_sourcemap_webpack(self):
exception = event.interfaces["exception"]
frame_list = exception.values[0].stacktrace.frames

assert event.data["scraping_attempts"] == [
{"url": "http://example.com/webpack1.min.js", "status": "not_attempted"},
{"url": "http://example.com/webpack1.min.js.map", "status": "not_attempted"},
{"url": "http://example.com/webpack2.min.js", "status": "not_attempted"},
{"url": "http://example.com/webpack2.min.js.map", "status": "not_attempted"},
]

# The first frame should be in_app.
first_frame = frame_list[0]
assert first_frame.in_app
Expand Down Expand Up @@ -563,6 +576,11 @@ def test_sourcemap_embedded_source_expansion(self):
}
]

assert event.data["scraping_attempts"] == [
{"status": "not_attempted", "url": "http://example.com/embedded.js"},
{"status": "not_attempted", "url": "http://example.com/embedded.js.map"},
]

exception = event.interfaces["exception"]
frame_list = exception.values[0].stacktrace.frames

Expand Down Expand Up @@ -628,6 +646,11 @@ def test_sourcemap_nofiles_source_expansion(self):

assert "errors" not in event.data

assert event.data["scraping_attempts"] == [
{"url": "app:///nofiles.js", "status": "not_attempted"},
{"url": "app:///nofiles.js.map", "status": "not_attempted"},
]

exception = event.interfaces["exception"]
frame_list = exception.values[0].stacktrace.frames

Expand Down Expand Up @@ -699,6 +722,13 @@ def test_indexed_sourcemap_source_expansion(self):

assert "errors" not in event.data

assert event.data["scraping_attempts"] == [
{"status": "not_attempted", "url": "http://example.com/indexed.min.js"},
{"status": "not_attempted", "url": "http://example.com/indexed.sourcemap.js"},
{"status": "not_attempted", "url": "http://example.com/file1.js"},
{"status": "not_attempted", "url": "http://example.com/file2.js"},
]

exception = event.interfaces["exception"]
frame_list = exception.values[0].stacktrace.frames

Expand Down
Loading