How to use rps_series_to_df method in yandex-tank

Best Python code snippet using yandex-tank

plugin.py

Source:plugin.py Github

copy

Full Screen

...227 except Exception:228 logger.warning('Failed to parse stpd file')229 logger.debug('', exc_info=True)230 return pandas.DataFrame()231 return self.rps_series_to_df(pandas.Series(rows_list))232 def count_actual_rps(self, data, last_piece):233 """ Counts actual rps on base of input chunk. Uses buffer for latest timestamp in df. """234 if not last_piece and not data.empty:235 concat_ts = pandas.concat([(data.ts / 1e6).astype(int), self.rps_metrics['actual_rps_latest']])236 self.rps_metrics['actual_rps_latest'] = concat_ts.loc[lambda s: s == concat_ts.max()]237 series_to_send = concat_ts.loc[lambda s: s < concat_ts.max()]238 df = self.rps_series_to_df(series_to_send) if series_to_send.any else pandas.DataFrame([])239 else:240 df = self.rps_series_to_df(self.rps_metrics['actual_rps_latest'])241 self.rps_metrics['actual_rps_latest'] = pandas.Series()242 return df243 @staticmethod244 def monitoring_data_to_dfs(data):245 panels = {}246 for chunk in data:247 for panel_name, content in chunk['data'].items():248 if panel_name in panels:249 for metric_name, value in content['metrics'].items():250 if metric_name in panels[panel_name]:251 panels[panel_name][metric_name]['value'].append(value)252 panels[panel_name][metric_name]['ts'].append(chunk['timestamp'])253 else:254 panels[panel_name][metric_name] = {'value': [value], 'ts': [chunk['timestamp']]}255 else:256 panels[panel_name] = {name: {'value': [value], 'ts': [chunk['timestamp']]} for name, value in content['metrics'].items()}257 return {'{}:{}'.format(panelk, name): pandas.DataFrame({'ts': [ts * 1000000 for ts in values['ts']], 'value': values['value']})258 for panelk, panelv in panels.items() for name, values in panelv.items()}259 @staticmethod260 def rps_series_to_df(series):261 df = series.value_counts().to_frame(name='value')262 df_to_send = df.rename_axis('ts')263 df_to_send.reset_index(inplace=True)264 df_to_send.loc[:, 'ts'] = (df_to_send['ts'] * 1e6).astype(int)265 return df_to_send266 @staticmethod267 def filter_df_by_case(df, case):268 """269 Filter dataframe by case name. If case is '__overall__', return all rows.270 :param df: DataFrame271 :param case: str with case name272 :return: DataFrame with columns 'ts' and 'value'273 """274 case = case.strip()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful