Best Python code snippet using yandex-tank
plugin.py
Source:plugin.py
...132 return retcode133 @property134 def is_telegraf(self):135 return True136 def get_metric_obj(self, col, case):137 """138 Generator of metric objects:139 Checks existent metrics and creates new metric if it does not exist.140 :param col: str with column name141 :param case: str with case name142 :return: metric object143 """144 case_metrics = self.metrics_objs.get(case)145 if case_metrics is None:146 for col, constructor in self.col_map.items():147 self.metrics_objs.setdefault(case, {})[col] = constructor(148 dict(self.meta,149 name=col,150 source='tank',151 importance='high' if col in self.importance_high else ''),152 raw=False, aggregate=True,153 parent=self.get_metric_obj(col, self.OVERALL) if case != self.OVERALL else None,154 case=case if case != self.OVERALL else None155 )156 return self.metrics_objs[case][col]157 def upload(self, df):158 self.upload_actual_rps(df)159 df_cases_set = set()160 for row in df.itertuples():161 if row.tag and isinstance(row.tag, str):162 df_cases_set.add(row.tag)163 if '|' in row.tag:164 for tag in row.tag.split('|'):165 df_cases_set.add(tag)166 for column in self.col_map:167 overall_metric_obj = self.get_metric_obj(column, self.OVERALL)168 df['value'] = df[column]169 result_df = self.filter_df_by_case(df, self.OVERALL)170 overall_metric_obj.put(result_df)171 for case_name in df_cases_set:172 case_metric_obj = self.get_metric_obj(column, case_name)173 df['value'] = df[column]174 result_df = self.filter_df_by_case(df, case_name)175 case_metric_obj.put(result_df)176 def upload_monitoring(self, data):177 for metric_name, df in self.monitoring_data_to_dfs(data).items():178 if metric_name not in self.monitoring_metrics:179 panel, metric = metric_name.split(':', 1)180 try:181 group, name = metric.split('_', 1)182 except ValueError:183 name = metric184 group = '_OTHER_'185 self.monitoring_metrics[metric_name] =\186 self.data_session.new_true_metric(...
__init__.py
Source:__init__.py
...53 if not verify:54 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)55 return PrometheusConnect(disable_ssl=not verify, **self._conn_params)56 @staticmethod57 def get_metric_obj(metric_data):58 return Metric(metric_data)59 @staticmethod60 def get_metric_obj_list(metric_data):...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!