Skip to content

Commit

Permalink
fixing graph enricher
Browse files Browse the repository at this point in the history
  • Loading branch information
Avi-Robusta committed Sep 23, 2024
1 parent 7456b53 commit a0f3dc5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/robusta/core/playbooks/prometheus_enrichment_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,21 +209,21 @@ def create_chart_from_prometheus_query(
label = get_target_name(series)

if not label:
label = "\n".join([v for (key, v) in series.metric.items() if key != "job"])
label = "\n".join([v for (key, v) in series["metric"].items() if key != "job"])

# If the label is empty, try to take it from the additional_label_factory
if label == "" and chart_label_factory is not None:
label = chart_label_factory(i)

values = []
for index in range(len(series.values)):
timestamp = series.timestamps[index]
value = round(float(series.values[index]), FLOAT_PRECISION_LIMIT)
for index in range(len(series["values"])):
timestamp = series["timestamps"][index]
value = round(float(series["values"][index]), FLOAT_PRECISION_LIMIT)
values.append((timestamp, value))
if value > max_y_value:
max_y_value = value
min_time = min(min_time, min(series.timestamps))
max_time = max(max_time, max(series.timestamps))
min_time = min(min_time, min(series["timestamps"]))
max_time = max(max_time, max(series["timestamps"]))

# Adjust min_time to ensure it is at least 1 hour before oom_kill_time, and adjust max_time to ensure it is at least 30 minutes after oom_kill_time, as required for the graph plot adjustments.
if oom_kill_time:
Expand Down

0 comments on commit a0f3dc5

Please sign in to comment.