wazuh / wazuh-qa

Wazuh - Quality Assurance
GNU General Public License v2.0
65 stars 32 forks source link

Data-visualizer error while creating graphs for remoted stats #3941

Closed Selutario closed 10 months ago

Selutario commented 1 year ago
Target version Related issue Related PR/dev branch
- - -

Description

The stats generated by wazuh-statistics tool for remoted:

wazuh-statistics -t remote -s 5 --store /tmp/remoted

seem to no longer contain the "queued_msgs" field, or at least not always. This causes an error when trying to generate graphs (stats used), as can be seen below:

# data-visualizer -s /tmp/logs/data/stats/remoted/wazuh-remoted_stats.csv -t remote -d /tmp/graphs3/ -n wazuh-remoted_stats
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/indexes/base.py", line 3802, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'queued_msgs'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/data-visualizer", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/wazuh_testing/scripts/data_visualizations.py", line 33, in main
    dv.plot()
  File "/usr/local/lib/python3.8/dist-packages/wazuh_testing/tools/performance/visualization.py", line 299, in plot
    self._plot_remoted_dataset()
  File "/usr/local/lib/python3.8/dist-packages/wazuh_testing/tools/performance/visualization.py", line 263, in _plot_remoted_dataset
    self._plot_data(elements=columns, title=title, generic_label=element)
  File "/usr/local/lib/python3.8/dist-packages/wazuh_testing/tools/performance/visualization.py", line 243, in _plot_data
    self._basic_plot(ax, self.dataframe[element], label=element, color=color)
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/frame.py", line 3807, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/indexes/base.py", line 3804, in get_loc
    raise KeyError(key) from err
KeyError: 'queued_msgs'

This means that during the workload benchmark tests it is not possible to generate remoted plots. Moreover, a very similar change was already necessary in the past:

The list of headers should be updated again to remove the "queued_msgs" field or, even better, modify the tool to make it more flexible to the fields it can find in the CSV.

davidjiglesias commented 10 months ago

To be reviewed in the upcoming refactors