Skip to content

Commit

Permalink
Add more sanity check to trace_length writing
Browse files Browse the repository at this point in the history
Reviewed By: alambert

Differential Revision: D63497450

fbshipit-source-id: 97ffa7de47a9056d58f085de08c16cb9487eb5ae
  • Loading branch information
Manuel Fahndrich authored and facebook-github-bot committed Sep 27, 2024
1 parent 4c11742 commit 44c9463
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sapp/pipeline/model_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,14 @@ def _generate_raw_trace_frame(
leaf_records = []
leaf_mapping_ids: Set[LeafMapping] = set()
for leaf, depth in leaves:
if not isinstance(depth, int) or depth < 0:
depth = None # avoid writing bad stuff to DB
# avoid writing bad trace_length to DB
if isinstance(depth, int):
if depth < 0:
depth = 0
elif depth > 1000:
depth = 1000
else:
depth = None
leaf_record = self._get_shared_text(leaf_kind, leaf)
caller_leaf_id = self.graph.get_transform_normalized_caller_kind_id(
leaf_record
Expand Down

0 comments on commit 44c9463

Please sign in to comment.