Skip to content

Commit

Permalink
feat: change conditional, argument and docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
rafabailon committed Jun 19, 2024
1 parent 5757bb6 commit ee85a1d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def get_script_arguments():
help=f'Base name for the images. Default {None}.')
parser.add_argument('-c', '--columns', dest='columns', default=None,
help=f'Path to Json with Columns to Plot. Default {None}.')
parser.add_argument('-u', '--unify', dest='unify', default=False,
help=f'Unify data of the binary processes with their subprocesses to plot. Default {False}.')
parser.add_argument('-u', '--unify', dest='unify', action='store_true',
help=f'Unify data of the binary processes with their subprocesses to plot.')

return parser.parse_args()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from matplotlib.ticker import LinearLocator

import json
import logging
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas as pd
Expand Down Expand Up @@ -48,9 +49,12 @@ def __init__(self, dataframes, target, compare=False, store_path=gettempdir(), x
if target in ['binary', 'analysis', 'remote', 'agent', 'logcollector', 'wazuhdb']:
self.columns_to_plot = self._load_columns_to_plot(columns_path)

if unify_child_daemon_metrics.lower() in ["true"] and target in ['binary']:
self.dataframe = self.dataframe.reset_index(drop=False)
self._unify_dataframes()
if unify_child_daemon_metrics:
if target == 'binary':
self.dataframe = self.dataframe.reset_index(drop=False)
self._unify_dataframes()
else:
logging.warning("Enabled unify is only available for binary data. Ignoring")

@staticmethod
def _color_palette(size):
Expand Down Expand Up @@ -92,7 +96,8 @@ def _load_dataframes(self):
self.dataframe = pd.concat([self.dataframe, new_csv])

def _unify_dataframes(self):
"""Unify dataframe values."""
"""Unify the data of each process with their respective sub-processes.
"""
pids = self.dataframe[['Daemon', 'PID']].drop_duplicates()
versions = self.dataframe[['Daemon', 'Version']].drop_duplicates()

Expand Down

0 comments on commit ee85a1d

Please sign in to comment.