Skip to content

Commit

Permalink
chore(view-hierarchy): Add proguard file size to span (#44826)
Browse files Browse the repository at this point in the history
Tracking the file size so we can understand its impact on timing
  • Loading branch information
narsaynorath authored and Andrii Soldatenko committed Feb 21, 2023
1 parent f7536e5 commit dbebef1
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit dbebef1

Please sign in to comment.