Compute all available target objectives and include them in metrics
This commit is contained in:
parent
240be46d58
commit
c423a4d435
|
@ -219,10 +219,11 @@ class BaseParser:
|
|||
raise ValueError(
|
||||
'Unknown metric type for {}: {}'.format(name, metadata.metric_type))
|
||||
|
||||
target_objective_instance = target_objectives.get_instance(
|
||||
self.dbms_id, target_objective)
|
||||
metric_data[target_objective] = target_objective_instance.compute(
|
||||
base_metric_data, observation_time)
|
||||
target_list = target_objectives.get_all(self.dbms_id)
|
||||
for target_name, target_instance in target_list.items():
|
||||
metric_data[target_name] = target_instance.compute(
|
||||
base_metric_data, observation_time)
|
||||
LOG.info("Added target '%s=%s' to metric data", target_name, metric_data[target_name])
|
||||
|
||||
return metric_data
|
||||
|
||||
|
|
|
@ -59,10 +59,18 @@ class BaseThroughput(BaseTargetObjective):
|
|||
super().__init__(name=THROUGHPUT, pprint='Throughput',
|
||||
unit='transactions / second', short_unit='txn/sec',
|
||||
improvement=MORE_IS_BETTER)
|
||||
if not isinstance(transactions_counter, (str, tuple)):
|
||||
raise TypeError(
|
||||
"Argument 'transactions_counter' must be str or tuple type, not {}.".format(
|
||||
type(transactions_counter)))
|
||||
self.transactions_counter = transactions_counter
|
||||
|
||||
def compute(self, metrics, observation_time):
|
||||
return float(metrics[self.transactions_counter]) / observation_time
|
||||
if isinstance(self.transactions_counter, tuple):
|
||||
num_txns = sum(metrics[ctr] for ctr in self.transactions_counter)
|
||||
else:
|
||||
num_txns = metrics[self.transactions_counter]
|
||||
return float(num_txns) / observation_time
|
||||
|
||||
|
||||
class TargetObjectives:
|
||||
|
@ -107,9 +115,13 @@ class TargetObjectives:
|
|||
if not self.registered():
|
||||
self.register()
|
||||
dbms_id = int(dbms_id)
|
||||
metadata = list(self._metric_metadatas[dbms_id])
|
||||
target_objective_instance = self._registry[dbms_id][target_objective]
|
||||
metadata.insert(0, (target_objective, target_objective_instance))
|
||||
targets_list = []
|
||||
for target_name, target_instance in self._registry[dbms_id].items():
|
||||
if target_name == target_objective:
|
||||
targets_list.insert(0, (target_name, target_instance))
|
||||
else:
|
||||
targets_list.append((target_name, target_instance))
|
||||
metadata = targets_list + list(self._metric_metadatas[dbms_id])
|
||||
return OrderedDict(metadata)
|
||||
|
||||
def default(self):
|
||||
|
|
|
@ -19,6 +19,7 @@ class DBTime(BaseTargetObjective):
|
|||
|
||||
|
||||
target_objective_list = tuple((DBMSType.ORACLE, target_obj) for target_obj in [ # pylint: disable=invalid-name
|
||||
BaseThroughput(transactions_counter='global.sysstat.user commits'),
|
||||
BaseThroughput(transactions_counter=('global.sysstat.user commits',
|
||||
'global.sysstat.user rollbacks')),
|
||||
DBTime(),
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue