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(
|
raise ValueError(
|
||||||
'Unknown metric type for {}: {}'.format(name, metadata.metric_type))
|
'Unknown metric type for {}: {}'.format(name, metadata.metric_type))
|
||||||
|
|
||||||
target_objective_instance = target_objectives.get_instance(
|
target_list = target_objectives.get_all(self.dbms_id)
|
||||||
self.dbms_id, target_objective)
|
for target_name, target_instance in target_list.items():
|
||||||
metric_data[target_objective] = target_objective_instance.compute(
|
metric_data[target_name] = target_instance.compute(
|
||||||
base_metric_data, observation_time)
|
base_metric_data, observation_time)
|
||||||
|
LOG.info("Added target '%s=%s' to metric data", target_name, metric_data[target_name])
|
||||||
|
|
||||||
return metric_data
|
return metric_data
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,18 @@ class BaseThroughput(BaseTargetObjective):
|
||||||
super().__init__(name=THROUGHPUT, pprint='Throughput',
|
super().__init__(name=THROUGHPUT, pprint='Throughput',
|
||||||
unit='transactions / second', short_unit='txn/sec',
|
unit='transactions / second', short_unit='txn/sec',
|
||||||
improvement=MORE_IS_BETTER)
|
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
|
self.transactions_counter = transactions_counter
|
||||||
|
|
||||||
def compute(self, metrics, observation_time):
|
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:
|
class TargetObjectives:
|
||||||
|
@ -107,9 +115,13 @@ class TargetObjectives:
|
||||||
if not self.registered():
|
if not self.registered():
|
||||||
self.register()
|
self.register()
|
||||||
dbms_id = int(dbms_id)
|
dbms_id = int(dbms_id)
|
||||||
metadata = list(self._metric_metadatas[dbms_id])
|
targets_list = []
|
||||||
target_objective_instance = self._registry[dbms_id][target_objective]
|
for target_name, target_instance in self._registry[dbms_id].items():
|
||||||
metadata.insert(0, (target_objective, target_objective_instance))
|
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)
|
return OrderedDict(metadata)
|
||||||
|
|
||||||
def default(self):
|
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
|
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(),
|
DBTime(),
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue