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

chore(view-hierarchy): Add proguard file size to span #44826

Merged
merged 3 commits into from
Feb 21, 2023
Merged
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
11 changes: 10 additions & 1 deletion src/sentry/lang/java/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import sentry_sdk
from symbolic import ProguardMapper

Expand Down Expand Up @@ -32,12 +34,19 @@ def get_proguard_images(event: Event):


def get_proguard_mapper(uuid: str, project: Project):
with sentry_sdk.start_span(op="proguard.get_proguard_mapper"):
with sentry_sdk.start_span(op="proguard.get_proguard_mapper") as span:
dif_paths = ProjectDebugFile.difcache.fetch_difs(project, [uuid], features=["mapping"])
debug_file_path = dif_paths.get(uuid)
if debug_file_path is None:
return

try:
proguard_file_size_in_mb = os.path.getsize(debug_file_path) / (1024 * 1024.0)
span.set_tag("proguard_file_size_in_mb", proguard_file_size_in_mb)
except OSError as exc:
sentry_sdk.capture_exception(exc)
return

mapper = ProguardMapper.open(debug_file_path)
if not mapper.has_line_info:
return
Expand Down