Skip to content

Commit

Permalink
chore: don't try to generate all 0 flamegraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenh-axiom-xyz committed Jan 10, 2025
1 parent 4826e35 commit c421044
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ci/scripts/metric_unify/flamegraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def get_stack_lines(metrics_dict, group_by_kvs, stack_keys, metric_name):
It will write a file with one line each for flamegraph.pl or inferno-flamegraph to consume.
"""
lines = []
non_zero = False

# Process counters
for counter in metrics_dict.get('counter', []):
Expand Down Expand Up @@ -42,10 +43,13 @@ def get_stack_lines(metrics_dict, group_by_kvs, stack_keys, metric_name):
stack = ';'.join(stack_values)
value = int(counter['value'])

if value != 0:
non_zero = True

lines.append(f"{stack} {value}")

# Currently cycle tracker does not use gauge
return lines
return lines if non_zero else []


def create_flamegraph(fname, metrics_dict, group_by_kvs, stack_keys, metric_name, reverse=False):
Expand Down

0 comments on commit c421044

Please sign in to comment.