diff options
author | Tibor Frank <tifrank@cisco.com> | 2022-10-03 15:11:02 +0200 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2022-10-03 15:14:24 +0200 |
commit | c6bfe865e4a62dda2c5e635df53083e909a6558b (patch) | |
tree | aaca7069ba8c77b6e47de56f1e00b239efdd9f56 /csit.infra.dash/app/pal/trending/graphs.py | |
parent | 3b57cc60251300ad79b42ec52cc2f6cc1e950165 (diff) |
CDash: Improvements in layout
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Change-Id: I28697efb31a7c661547872bedb696317197b5c7f
Diffstat (limited to 'csit.infra.dash/app/pal/trending/graphs.py')
-rw-r--r-- | csit.infra.dash/app/pal/trending/graphs.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/csit.infra.dash/app/pal/trending/graphs.py b/csit.infra.dash/app/pal/trending/graphs.py index 1eff4aa889..6f1ec84825 100644 --- a/csit.infra.dash/app/pal/trending/graphs.py +++ b/csit.infra.dash/app/pal/trending/graphs.py @@ -20,8 +20,6 @@ import pandas as pd import hdrh.histogram import hdrh.codec -from datetime import datetime - from ..utils.constants import Constants as C from ..utils.utils import classify_anomalies, get_color @@ -120,8 +118,6 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame, df = df.dropna(subset=[C.VALUE[ttype], ]) if df.empty: return list() - if df.empty: - return list() x_axis = df["start_time"].tolist() if ttype == "pdr-lat": @@ -135,6 +131,7 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame, hover = list() customdata = list() + customdata_samples = list() for idx, (_, row) in enumerate(df.iterrows()): d_type = "trex" if row["dut_type"] == "none" else row["dut_type"] hover_itm = ( @@ -157,7 +154,11 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame, ).replace("<stdev>", stdev) hover.append(hover_itm) if ttype == "pdr-lat": - customdata.append(_get_hdrh_latencies(row, name)) + customdata_samples.append(_get_hdrh_latencies(row, name)) + customdata.append({"name": name}) + else: + customdata_samples.append({"name": name, "show_telemetry": True}) + customdata.append({"name": name}) hover_trend = list() for avg, stdev, (_, row) in zip(trend_avg, trend_stdev, df.iterrows()): @@ -189,7 +190,7 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame, hoverinfo="text+name", showlegend=True, legendgroup=name, - customdata=customdata + customdata=customdata_samples ), go.Scatter( # Trend line x=x_axis, @@ -205,6 +206,7 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame, hoverinfo="text+name", showlegend=False, legendgroup=name, + customdata=customdata ) ] @@ -237,6 +239,7 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame, showlegend=False, legendgroup=name, name=name, + customdata=customdata, marker={ "size": 15, "symbol": "circle-open", @@ -297,8 +300,6 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict, if df is None or df.empty: continue - name = "-".join((itm["dut"], itm["phy"], itm["framesize"], itm["core"], - itm["test"], itm["testtype"], )) if normalize: phy = itm["phy"].split("-") topo_arch = f"{phy[0]}-{phy[1]}" if len(phy) == 4 else str() @@ -306,18 +307,16 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict, if topo_arch else 1.0 else: norm_factor = 1.0 - traces = _generate_trending_traces( - itm["testtype"], name, df, get_color(idx), norm_factor - ) + traces = _generate_trending_traces(itm["testtype"], itm["id"], df, + get_color(idx), norm_factor) if traces: if not fig_tput: fig_tput = go.Figure() fig_tput.add_traces(traces) if itm["testtype"] == "pdr": - traces = _generate_trending_traces( - "pdr-lat", name, df, get_color(idx), norm_factor - ) + traces = _generate_trending_traces("pdr-lat", itm["id"], df, + get_color(idx), norm_factor) if traces: if not fig_lat: fig_lat = go.Figure() @@ -348,7 +347,7 @@ def graph_hdrh_latency(data: dict, layout: dict) -> go.Figure: for idx, (lat_name, lat_hdrh) in enumerate(data.items()): try: decoded = hdrh.histogram.HdrHistogram.decode(lat_hdrh) - except (hdrh.codec.HdrLengthException, TypeError) as err: + except (hdrh.codec.HdrLengthException, TypeError): continue previous_x = 0.0 prev_perc = 0.0 |