C-Dash: Add possiblity to remove outliers from comparison data
[csit.git] / csit.infra.dash / app / cdash / utils / constants.py
1 # Copyright (c) 2024 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 """Constants used in CDash.
15
16 "Constant" means a value that keeps its value since initialization. The value
17 does not need to be hard coded here, but can be read from environment variables.
18 """
19
20 import logging
21
22 from dash import html
23
24
25 class Constants:
26     """Constants used in CDash.
27     """
28
29     ############################################################################
30     # General, application wide constants.
31
32     # Logging settings.
33     LOG_LEVEL = logging.INFO
34     LOG_FORMAT = "%(asctime)s: %(levelname)s: %(message)s"
35     LOG_DATE_FORMAT = "%Y/%m/%d %H:%M:%S"
36
37     # The application title.
38     TITLE = "FD.io CSIT"
39     BRAND = "CSIT-Dash"
40
41     # The application description.
42     DESCRIPTION = "Performance Dashboard"
43
44     # External stylesheets.
45     EXTERNAL_STYLESHEETS = ["/static/dist/css/bootstrap.css", ]
46
47     # URL to Jenkins
48     URL_JENKINS = "https://jenkins.fd.io/job/"
49
50     # URL to the documentation
51     URL_DOC_TRENDING = "https://csit.fd.io/cdocs/methodology/trending/analysis/"
52     URL_DOC_REL_NOTES = "https://csit.fd.io/cdocs/release_notes/current/"
53
54     # Path and name of the file specifying the HTML layout of the dash
55     # application.
56     MAIN_HTML_LAYOUT_FILE = "base_layout.jinja2"
57
58     # Path and name of the file specifying the HTML layout of the dash
59     # application.
60     HTML_LAYOUT_FILE = "cdash/templates/dash_layout.jinja2"
61
62     # Application root.
63     APPLICATIN_ROOT = "/"
64
65     # Data to be downloaded from the parquets specification file.
66     DATA_SPEC_FILE = "cdash/data/data.yaml"
67
68     # Path to schemas to use when reading data from the parquet.
69     PATH_TO_SCHEMAS = "cdash/data/_metadata/"
70
71     # The file with tooltips.
72     TOOLTIP_FILE = "cdash/utils/tooltips.yaml"
73
74     # Maximal value of TIME_PERIOD for data read from the parquets in days.
75     # Do not change without a good reason.
76     MAX_TIME_PERIOD = 250
77
78     # It defines the time period for data read from the parquets in days from
79     # now back to the past.
80     # TIME_PERIOD = None - means all data (max MAX_TIME_PERIOD days) is read.
81     # TIME_PERIOD = MAX_TIME_PERIOD - is the default value
82     TIME_PERIOD = MAX_TIME_PERIOD  # [days]
83
84     ############################################################################
85     # General, application wide, layout affecting constants.
86
87     # Add a time delay (in ms) to the spinner being shown
88     SPINNER_DELAY = 500
89
90     # If True, clear all inputs in control panel when button "ADD SELECTED" is
91     # pressed.
92     CLEAR_ALL_INPUTS = False
93
94     # The element is disabled.
95     STYLE_DISABLED = {"visibility": "hidden"}
96
97     # The element is enabled and visible.
98     STYLE_ENABLED = {"visibility": "visible"}
99
100     # The element is not displayed.
101     STYLE_DONT_DISPLAY = {"display": "none"}
102
103     # The element is displaed.
104     STYLE_DISPLAY = {"display": "flex"}
105
106     # Checklist "All" is disabled.
107     CL_ALL_DISABLED = [
108         {
109             "label": "All",
110             "value": "all",
111             "disabled": True
112         }
113     ]
114
115     # Checklist "All" is enabled, visible and unchecked.
116     CL_ALL_ENABLED = [
117         {
118             "label": "All",
119             "value": "all",
120             "disabled": False
121         }
122     ]
123
124     # Placeholder for any element in the layout.
125     PLACEHOLDER = html.Nobr("")
126
127     # List of drivers used in CSIT.
128     DRIVERS = ("avf", "af-xdp", "rdma", "dpdk", "mlx5")
129
130     # Labels for input elements (dropdowns, ...).
131     LABELS = {
132         "dpdk": "DPDK",
133         "container_memif": "LXC/DRC Container Memif",
134         "crypto": "IPSec IPv4 Routing",
135         "gso": "GSO",
136         "ip4": "IPv4 Routing",
137         "ip4_tunnels": "IPv4 Tunnels",
138         "ip6": "IPv6 Routing",
139         "ip6_tunnels": "IPv6 Tunnels",
140         "l2": "L2 Ethernet Switching",
141         "lb": "Load Balancer",
142         "srv6": "SRv6 Routing",
143         "vm_vhost": "VMs vhost-user",
144         "nfv_density.dcr_memif.chain_ipsec": "CNF Service Chains Routing IPSec",
145         "nfv_density.vm_vhost.chain_dot1qip4vxlan":"VNF Service Chains Tunnels",
146         "nfv_density.vm_vhost.chain": "VNF Service Chains Routing",
147         "nfv_density.dcr_memif.pipeline": "CNF Service Pipelines Routing",
148         "nfv_density.dcr_memif.chain": "CNF Service Chains Routing",
149         "hoststack": "Hoststack",
150         "flow": "Flow",
151         "l2bd": "L2 Bridge Domain",
152         "crypto.ethip4": "IPSec IPv4 Routing",
153         "crypto.ethip6": "IPSec IPv6 Routing",
154         "interfaces": "Interfaces",
155         "ip4_tunnels.lisp": "IPv4 Tunnels LISP",
156         "ip6_tunnels.lisp": "IPv6 Tunnels LISP",
157         "l2patch": "L2 Patch",
158         "l2xc": "L2 Cross Connect",
159         "vm_vhost.ethip4": "VMs vhost-user IPv4 Routing",
160         "vm_vhost.ethip6": "VMs vhost-user IPv6 Routing"
161     }
162
163     # URL style.
164     URL_STYLE = {
165         "background-color": "#d2ebf5",
166         "border-color": "#bce1f1",
167         "color": "#135d7c"
168     }
169
170     ############################################################################
171     # General, normalization constants.
172
173     NORM_FREQUENCY = 2.0  # [GHz]
174     FREQUENCY = {  # [GHz]
175         "1n-aws": 3.400,
176         "2n-aws": 3.400,
177         "2n-c6in": 3.500,
178         "2n-clx": 2.300,
179         "2n-icx": 2.600,
180         "2n-spr": 2.800,
181         "2n-tx2": 2.500,
182         "2n-zn2": 2.900,
183         "3n-alt": 3.000,
184         "3n-icx": 2.600,
185         "3n-icxd": 2.000,
186         "3n-snr": 2.200,
187         "3n-tsh": 2.200,
188         "3na-spr": 2.800,
189         "3nb-spr": 2.800
190     }
191
192     ############################################################################
193     # General, plots and tables constants.
194
195     PLOT_COLORS = (
196         "#1A1110", "#DA2647", "#214FC6", "#01786F", "#BD8260", "#FFD12A",
197         "#A6E7FF", "#738276", "#C95A49", "#FC5A8D", "#CEC8EF", "#391285",
198         "#6F2DA8", "#FF878D", "#45A27D", "#FFD0B9", "#FD5240", "#DB91EF",
199         "#44D7A8", "#4F86F7", "#84DE02", "#FFCFF1", "#614051"
200     )
201
202     # Trending, anomalies.
203     ANOMALY_COLOR = {
204         "regression": 0.0,
205         "normal": 0.5,
206         "progression": 1.0
207     }
208
209     COLORSCALE_TPUT = [
210         [0.00, "red"],
211         [0.33, "red"],
212         [0.33, "white"],
213         [0.66, "white"],
214         [0.66, "green"],
215         [1.00, "green"]
216     ]
217
218     TICK_TEXT_TPUT = ["Regression", "Normal", "Progression"]
219
220     COLORSCALE_LAT = [
221         [0.00, "green"],
222         [0.33, "green"],
223         [0.33, "white"],
224         [0.66, "white"],
225         [0.66, "red"],
226         [1.00, "red"]
227     ]
228
229     TICK_TEXT_LAT = ["Progression", "Normal", "Regression"]
230
231     # Access to the results.
232     VALUE = {
233         "mrr": "result_receive_rate_rate_avg",
234         "ndr": "result_ndr_lower_rate_value",
235         "pdr": "result_pdr_lower_rate_value",
236         "mrr-bandwidth": "result_receive_rate_bandwidth_avg",
237         "ndr-bandwidth": "result_ndr_lower_bandwidth_value",
238         "pdr-bandwidth": "result_pdr_lower_bandwidth_value",
239         "latency": "result_latency_forward_pdr_50_avg",
240         "hoststack-cps": "result_rate_value",
241         "hoststack-rps": "result_rate_value",
242         "hoststack-cps-bandwidth": "result_bandwidth_value",
243         "hoststack-rps-bandwidth": "result_bandwidth_value",
244         "hoststack-bps": "result_bandwidth_value",
245         "hoststack-latency": "result_latency_value"
246     }
247
248     VALUE_ITER = {
249         "mrr": "result_receive_rate_rate_values",
250         "ndr": "result_ndr_lower_rate_value",
251         "pdr": "result_pdr_lower_rate_value",
252         "mrr-bandwidth": "result_receive_rate_bandwidth_avg",
253         "ndr-bandwidth": "result_ndr_lower_bandwidth_value",
254         "pdr-bandwidth": "result_pdr_lower_bandwidth_value",
255         "latency": "result_latency_forward_pdr_50_avg",
256         "hoststack-cps": "result_rate_value",
257         "hoststack-rps": "result_rate_value",
258         "hoststack-bps": "result_bandwidth_value",
259         "hoststack-latency": "result_latency_value"
260     }
261
262     UNIT = {
263         "mrr": "result_receive_rate_rate_unit",
264         "ndr": "result_ndr_lower_rate_unit",
265         "pdr": "result_pdr_lower_rate_unit",
266         "mrr-bandwidth": "result_receive_rate_bandwidth_unit",
267         "ndr-bandwidth": "result_ndr_lower_bandwidth_unit",
268         "pdr-bandwidth": "result_pdr_lower_bandwidth_unit",
269         "latency": "result_latency_forward_pdr_50_unit",
270         "hoststack-cps": "result_rate_unit",
271         "hoststack-rps": "result_rate_unit",
272         "hoststack-cps-bandwidth": "result_bandwidth_unit",
273         "hoststack-rps-bandwidth": "result_bandwidth_unit",
274         "hoststack-bps": "result_bandwidth_unit",
275         "hoststack-latency": "result_latency_unit"
276     }
277
278     # Latencies.
279     LAT_HDRH = (  # Do not change the order
280         "result_latency_forward_pdr_0_hdrh",
281         "result_latency_reverse_pdr_0_hdrh",
282         "result_latency_forward_pdr_10_hdrh",
283         "result_latency_reverse_pdr_10_hdrh",
284         "result_latency_forward_pdr_50_hdrh",
285         "result_latency_reverse_pdr_50_hdrh",
286         "result_latency_forward_pdr_90_hdrh",
287         "result_latency_reverse_pdr_90_hdrh",
288     )
289
290     # This value depends on latency stream rate (9001 pps) and duration (5s).
291     # Keep it slightly higher to ensure rounding errors to not remove tick mark.
292     PERCENTILE_MAX = 99.999501
293
294     GRAPH_LAT_HDRH_DESC = {
295         "result_latency_forward_pdr_0_hdrh": "No-load.",
296         "result_latency_reverse_pdr_0_hdrh": "No-load.",
297         "result_latency_forward_pdr_10_hdrh": "Low-load, 10% PDR.",
298         "result_latency_reverse_pdr_10_hdrh": "Low-load, 10% PDR.",
299         "result_latency_forward_pdr_50_hdrh": "Mid-load, 50% PDR.",
300         "result_latency_reverse_pdr_50_hdrh": "Mid-load, 50% PDR.",
301         "result_latency_forward_pdr_90_hdrh": "High-load, 90% PDR.",
302         "result_latency_reverse_pdr_90_hdrh": "High-load, 90% PDR."
303     }
304
305     # Operators used to filter data in comparison tables.
306     OPERATORS = (
307         ("contains ", ),
308         ("lt ", "<"),
309         ("gt ", ">"),
310         ("eq ", "="),
311         ("ge ", ">="),
312         ("le ", "<="),
313         ("ne ", "!="),
314         ("datestartswith ", )
315     )
316
317     ############################################################################
318     # News.
319
320     # The title.
321     NEWS_TITLE = "Failures and Anomalies"
322
323     # The pathname prefix for the application.
324     NEWS_ROUTES_PATHNAME_PREFIX = "/news/"
325
326     # Time period for regressions and progressions.
327     NEWS_TIME_PERIOD = TIME_PERIOD  # [days]
328
329     # Time periods for summary tables.
330     NEWS_LAST = 1  # [days]
331     NEWS_SHORT = 7  # [days]
332     NEWS_LONG = NEWS_TIME_PERIOD  # [days]
333
334     ############################################################################
335     # Report.
336
337     # The title.
338     REPORT_TITLE = "Per Release Performance"
339
340     # The pathname prefix for the application.
341     REPORT_ROUTES_PATHNAME_PREFIX = "/report/"
342
343     # Layout of plot.ly graphs.
344     REPORT_GRAPH_LAYOUT_FILE = "cdash/report/layout.yaml"
345
346     # Default name of downloaded file with selected data.
347     REPORT_DOWNLOAD_FILE_NAME = "iterative_data.csv"
348
349     ############################################################################
350     # Comparisons.
351
352     # The title.
353     COMP_TITLE = "Per Release Performance Comparisons"
354
355     # The pathname prefix for the application.
356     COMP_ROUTES_PATHNAME_PREFIX = "/comparisons/"
357
358     # Default name of downloaded file with selected data.
359     COMP_DOWNLOAD_FILE_NAME = "comparison_data.csv"
360
361     # This parameter specifies the method to use for estimating the percentile.
362     # Possible values:
363     # - inverted_cdf
364     # - averaged_inverted_cdf
365     # - closest_observation
366     # - interpolated_inverted_cdf
367     # - hazen
368     # - weibull
369     # - linear (default)
370     # - median_unbiased
371     # - normal_unbiased
372     COMP_PERCENTILE_METHOD = "linear"
373
374     # Extreme or mild outlier?
375     OUTLIER_EXTREME = 3
376     OUTLIER_MILD = 1.5
377     COMP_OUTLIER_TYPE = OUTLIER_EXTREME
378
379     ############################################################################
380     # Statistics.
381
382     # The title.
383     STATS_TITLE = "Test Job Statistics"
384
385     # The pathname prefix for the application.
386     STATS_ROUTES_PATHNAME_PREFIX = "/stats/"
387
388     # Layout of plot.ly graphs.
389     STATS_GRAPH_LAYOUT_FILE = "cdash/stats/layout.yaml"
390
391     # The default job displayed when the page is loaded first time.
392     STATS_DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx"
393
394     # Default name of downloaded file with selected data.
395     STATS_DOWNLOAD_FILE_NAME = "stats.csv"
396
397     # The width of the bar in the graph in miliseconds.
398     STATS_BAR_WIDTH_DAILY = 1000 * 3600 * 15
399     STATS_BAR_WIDTH_WEEKLY = 1000 * 3600 * 24
400
401     ############################################################################
402     # Trending.
403
404     # The title.
405     TREND_TITLE = "Performance Trending"
406
407     # The pathname prefix for the application.
408     TREND_ROUTES_PATHNAME_PREFIX = "/trending/"
409
410     # Layout of plot.ly graphs.
411     TREND_GRAPH_LAYOUT_FILE = "cdash/trending/layout.yaml"
412
413     # Default name of downloaded file with selected data.
414     TREND_DOWNLOAD_FILE_NAME = "trending_data.csv"
415     TELEMETRY_DOWNLOAD_FILE_NAME = "telemetry_data.csv"
416
417     ############################################################################
418     # Coverage data.
419
420     # The title.
421     COVERAGE_TITLE = "Per Release Coverage Data"
422
423     # The pathname prefix for the application.
424     COVERAGE_ROUTES_PATHNAME_PREFIX = "/coverage/"
425
426     # Default name of downloaded file with selected data.
427     COVERAGE_DOWNLOAD_FILE_NAME = "coverage_data.csv"
428
429     ############################################################################
430     # Search tests.
431
432     # The title.
433     SEARCH_TITLE = "Search Tests"
434
435     # The pathname prefix for the application.
436     SEARCH_ROUTES_PATHNAME_PREFIX = "/search/"
437
438     # Layout of plot.ly graphs.
439     SEARCH_GRAPH_LAYOUT_FILE = "cdash/search/layout.yaml"
440
441     # Default name of downloaded file with selected data.
442     SEARCH_DOWNLOAD_FILE_NAME = "search_data.csv"
443
444     ############################################################################