Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
C-Dash: Do not generate always all graphs
[csit.git]
/
csit.infra.dash
/
app
/
cdash
/
trending
/
graphs.py
diff --git
a/csit.infra.dash/app/cdash/trending/graphs.py
b/csit.infra.dash/app/cdash/trending/graphs.py
index
7d74775
..
32ab8df
100644
(file)
--- a/
csit.infra.dash/app/cdash/trending/graphs.py
+++ b/
csit.infra.dash/app/cdash/trending/graphs.py
@@
-389,8
+389,8
@@
def graph_tm_trending(
:rtype: list
"""
traces = list()
:rtype: list
"""
traces = list()
-
nr_of_metrics = len(data.tm_metric.unique()
)
- for idx, metric in enumerate(
data.tm_metric.unique()
):
+
metrics = data.tm_metric.unique().tolist(
)
+ for idx, metric in enumerate(
metrics
):
if "-pdr" in test and "='pdr'" not in metric:
continue
if "-ndr" in test and "='ndr'" not in metric:
if "-pdr" in test and "='pdr'" not in metric:
continue
if "-ndr" in test and "='ndr'" not in metric:
@@
-449,7
+449,7
@@
def graph_tm_trending(
else:
anomalies = None
if all_in_one:
else:
anomalies = None
if all_in_one:
- color = get_color(color_index *
nr_of_metrics
+ idx)
+ color = get_color(color_index *
len(metrics)
+ idx)
metric_name = f"{test}<br>{metric}"
else:
color = get_color(idx)
metric_name = f"{test}<br>{metric}"
else:
color = get_color(idx)
@@
-502,7
+502,7
@@
def graph_tm_trending(
anomaly_color.append(C.ANOMALY_COLOR[anomaly])
hover_itm = (
f"date: {x_axis[idx].strftime('%Y-%m-%d %H:%M:%S')}"
anomaly_color.append(C.ANOMALY_COLOR[anomaly])
hover_itm = (
f"date: {x_axis[idx].strftime('%Y-%m-%d %H:%M:%S')}"
- f"<br>trend: {trend_avg[idx]:,.
0
f}"
+ f"<br>trend: {trend_avg[idx]:,.
2
f}"
f"<br>classification: {anomaly}"
)
hover.append(hover_itm)
f"<br>classification: {anomaly}"
)
hover.append(hover_itm)
@@
-543,7
+543,10
@@
def graph_tm_trending(
)
)
)
)
- return traces
+ unique_metrics = set()
+ for itm in metrics:
+ unique_metrics.add(itm.split("{", 1)[0])
+ return traces, unique_metrics
tm_trending_graphs = list()
graph_layout = layout.get("plot-trending-telemetry", dict())
tm_trending_graphs = list()
graph_layout = layout.get("plot-trending-telemetry", dict())
@@
-551,22
+554,26
@@
def graph_tm_trending(
if all_in_one:
all_traces = list()
if all_in_one:
all_traces = list()
+ all_metrics = set()
+ all_tests = list()
for idx, test in enumerate(data.test_name.unique()):
df = data.loc[(data["test_name"] == test)]
for idx, test in enumerate(data.test_name.unique()):
df = data.loc[(data["test_name"] == test)]
- traces = _generate_traces(df, test, all_in_one, idx)
+ traces
, metrics
= _generate_traces(df, test, all_in_one, idx)
if traces:
if traces:
+ all_metrics.update(metrics)
if all_in_one:
all_traces.extend(traces)
if all_in_one:
all_traces.extend(traces)
+ all_tests.append(test)
else:
graph = go.Figure()
graph.add_traces(traces)
graph.update_layout(graph_layout)
else:
graph = go.Figure()
graph.add_traces(traces)
graph.update_layout(graph_layout)
- tm_trending_graphs.append((graph,
test
, ))
+ tm_trending_graphs.append((graph,
[test, ]
, ))
if all_in_one:
graph = go.Figure()
graph.add_traces(all_traces)
graph.update_layout(graph_layout)
if all_in_one:
graph = go.Figure()
graph.add_traces(all_traces)
graph.update_layout(graph_layout)
- tm_trending_graphs.append((graph,
str()
, ))
+ tm_trending_graphs.append((graph,
all_tests
, ))
- return tm_trending_graphs
+ return tm_trending_graphs
, list(all_metrics)