def calculate_key_stats(self, metric_store):
    stats_to_calculate = ['mean', 'std', 'median', 'min', 'max']  # TODO: get input from user
    percentiles_to_calculate = range(5, 101, 5)  # TODO: get input from user
    percentiles_to_calculate.append(99)
    for transaction in metric_store['t'].keys():
      transaction_key = transaction + '.' + 'ResponseTime'
      # For ResponseTime and ResponseSize, each timestamp has a list of values associated with it.
      # Using heapq.merge to merge all the lists into a single list to be passed to numpy.
      self.calculated_stats[transaction_key], self.calculated_percentiles[transaction_key] = \
          naarad.utils.calculate_stats(list(heapq.merge(*metric_store['t'][transaction].values())),
                                   stats_to_calculate, percentiles_to_calculate)
      self.update_summary_stats(transaction_key)
      transaction_key = transaction + '.' + 'qps'
      if len(metric_store['qps'][transaction].values()) > 0:
        self.calculated_stats[transaction_key], self.calculated_percentiles[transaction_key] = \
            naarad.utils.calculate_stats(metric_store['qps'][transaction].values(),
                                         stats_to_calculate, percentiles_to_calculate)
        self.update_summary_stats(transaction_key)
      transaction_key = transaction + '.' + 'ResponseSize'
      self.calculated_stats[transaction_key], self.calculated_percentiles[transaction_key] = \
          naarad.utils.calculate_stats(list(heapq.merge(*metric_store['by'][transaction].values())),
                                       stats_to_calculate, percentiles_to_calculate)
      self.update_summary_stats(transaction_key)
      if 'eqps' in metric_store.keys() and transaction in metric_store['eqps'].keys():
        transaction_key = transaction + '.' + 'ErrorsPerSecond'
        self.calculated_stats[transaction_key], self.calculated_percentiles[transaction_key] = \
            naarad.utils.calculate_stats(metric_store['eqps'][transaction].values(),
                                         stats_to_calculate, percentiles_to_calculate)
        self.update_summary_stats(transaction + '.' + 'ErrorsPerSecond')
      transaction_key = transaction + '.' + 'DataThroughput'
      self.calculated_stats[transaction_key], self.calculated_percentiles[transaction_key] = \
          naarad.utils.calculate_stats(metric_store['thr'][transaction].values(),
                                       stats_to_calculate, percentiles_to_calculate)
      self.update_summary_stats(transaction_key)
    return None
Request a shell and return a deferred reply.
dataset/ETHPy150Open linkedin/naarad/src/naarad/metrics/jmeter_metric.py/JmeterMetric.calculate_key_stats--crossover with--dataset/ETHPy150Open sporsh/carnifex/carnifex/ssh/session.py/SSHSession.requestShell