X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=csit.infra.dash%2Fapp%2Fcdash%2Ftrending%2Fgraphs.py;h=7b14501decb7c0e7495e301fbcd4766dbd1b7c5d;hp=7d747756a58c478607d17ae31e5dd358a6e1b4a3;hb=0d6639a38336a3f73e276d81c86ea0d0895e1f40;hpb=8acd67e97d2c6553e699c4e161e408ec3f53c32e diff --git a/csit.infra.dash/app/cdash/trending/graphs.py b/csit.infra.dash/app/cdash/trending/graphs.py index 7d747756a5..7b14501dec 100644 --- 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() - 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: @@ -449,7 +449,7 @@ def graph_tm_trending( 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}
{metric}" else: color = get_color(idx) @@ -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()) @@ -551,22 +554,26 @@ def graph_tm_trending( 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)] - traces = _generate_traces(df, test, all_in_one, idx) + traces, metrics = _generate_traces(df, test, all_in_one, idx) if traces: + all_metrics.update(metrics) 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) - 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) - tm_trending_graphs.append((graph, str(), )) + tm_trending_graphs.append((graph, all_tests, )) - return tm_trending_graphs + return tm_trending_graphs, all_metrics