diff --git a/bzt/modules/aggregator.py b/bzt/modules/aggregator.py index cc4c66d093..1ea1ea4258 100644 --- a/bzt/modules/aggregator.py +++ b/bzt/modules/aggregator.py @@ -647,7 +647,7 @@ def __init__(self, perc_levels=None): self.track_percentiles = perc_levels @staticmethod - def get_mixed_label(label, rc=None, msg=None): + def get_state(label, rc=None, msg=None): # it is used for generation of extended label. # each label data is split according to sample state (success/error/assert) @@ -658,13 +658,13 @@ def http_mark(): rc = int(rc) if is_int(rc) else 0 # it's jmeter_error by default if msg: if rc > 299 or http_mark(): - group = SAMPLE_STATES[2] # http error + state = SAMPLE_STATES[2] # http error else: - group = SAMPLE_STATES[1] # jmeter error + state = SAMPLE_STATES[1] # jmeter error else: - group = SAMPLE_STATES[0] # succeeded sample + state = SAMPLE_STATES[0] # succeeded sample - return '-'.join((label, str(group))) + return state def __process_readers(self, final_pass=False): """ @@ -721,6 +721,7 @@ def __aggregate_current(self, datapoint, samples): overall = KPISet(self.track_percentiles, self.__get_rtimes_max(''), ext_aggregation=self._redundant_aggregation) for label in current.values(): + overall.merge_kpis(label, datapoint[DataPoint.SOURCE_ID]) current[''] = overall @@ -734,17 +735,19 @@ def _get_suffix(self, label): return '' def __add_sample(self, current, label, kpis): - if self._redundant_aggregation: - # kpis format: conc, r_time, con_time, latency, r_code, error_msg, trname, byte_count - label = self.get_mixed_label(label=label, rc=kpis[4], msg=kpis[5]) + # kpis format: conc, r_time, con_time, latency, r_code, error_msg, trname, byte_count + state = self.get_state(label=label, rc=kpis[4], msg=kpis[5]) if label not in current: - current[label] = KPISet( + current[label] = dict() + + if state not in current[label]: + current[label][state] = KPISet( perc_levels=self.track_percentiles, hist_max_rt=self.__get_rtimes_max(label), ext_aggregation=self._redundant_aggregation) - current[label].add_sample(kpis) + current[label][state].add_sample(kpis) def __get_rtimes_max(self, label): if label in self.cumulative: @@ -879,7 +882,7 @@ def prepare(self): self.track_percentiles.sort() self.settings["percentiles"] = self.track_percentiles - self.set_aggregation(self.settings.get('extend-aggregation')) + self.set_aggregation(self.settings.get('extend-aggregation', True)) self.ignored_labels = self.settings.get("ignore-labels", self.ignored_labels) self.generalize_labels = self.settings.get("generalize-labels", self.generalize_labels) diff --git a/bzt/modules/jmeter.py b/bzt/modules/jmeter.py index e7d6f9d435..0ead9b9326 100644 --- a/bzt/modules/jmeter.py +++ b/bzt/modules/jmeter.py @@ -836,7 +836,7 @@ def __init__(self, filename, parent_logger, errors_filename=None, err_msg_separa self.read_records = 0 if errors_filename: self.errors_reader = JTLErrorsReader( - errors_filename, parent_logger, err_msg_separator, label_converter=self.get_mixed_label) + errors_filename, parent_logger, err_msg_separator, get_state=self.get_state) else: self.errors_reader = None @@ -1187,7 +1187,7 @@ class JTLErrorsReader(object): """ url_xpath = GenericTranslator().css_to_xpath("java\\.net\\.URL") - def __init__(self, filename, parent_logger, err_msg_separator=None, label_converter=None): + def __init__(self, filename, parent_logger, err_msg_separator=None, get_state=None): # http://stackoverflow.com/questions/9809469/python-sax-to-lxml-for-80gb-xml/9814580#9814580 super(JTLErrorsReader, self).__init__() self.log = parent_logger.getChild(self.__class__.__name__) @@ -1196,7 +1196,7 @@ def __init__(self, filename, parent_logger, err_msg_separator=None, label_conver self.buffer = BetterDict() self.failed_processing = False self.err_msg_separator = err_msg_separator - self.label_converter = label_converter + self.get_state = get_state self._redundant_aggregation = False def set_aggregation(self, aggregation): @@ -1287,8 +1287,7 @@ def _extract_common(self, elem, label, r_code, t_stamp, r_msg): err_item = KPISet.error_item_skel(f_msg, f_rc, 1, f_type, url_counts, f_tag) buf = self.buffer.get(t_stamp, force_set=True) - if self._redundant_aggregation: - label = self.label_converter(label=label, rc=r_code, msg=r_msg) + state = self.get_state(label=label, rc=r_code, msg=r_msg) KPISet.inc_list(buf.get(label, [], force_set=True), ("msg", f_msg), err_item) KPISet.inc_list(buf.get('', [], force_set=True), ("msg", f_msg), err_item)