use dba_hist (continue)

This commit is contained in:
yangdsh 2020-04-09 13:29:35 -04:00 committed by Dana Van Aken
parent e0cb1ab8b0
commit e5113f73f5
3 changed files with 18 additions and 15 deletions

View File

@ -59,7 +59,8 @@ def create_settings(metric_data, dbms):
if 'average' in name or name.endswith('current') or \ if 'average' in name or name.endswith('current') or \
name.startswith('sysstat.session pga memory') or \ name.startswith('sysstat.session pga memory') or \
name.startswith('sysstat.session uga memory') or \ name.startswith('sysstat.session uga memory') or \
name.endswith('wait_class#'): name.endswith('wait_class#') or \
name.endswith('wait_class_id'):
mettype = 3 # Statistic mettype = 3 # Statistic
else: else:
mettype = 1 # Counter - most common type of numeric metric mettype = 1 # Counter - most common type of numeric metric
@ -70,11 +71,12 @@ def create_settings(metric_data, dbms):
if name == 'sysstat.user commits': if name == 'sysstat.user commits':
assert vartype == 2 and 1 # Check it's an int/counter assert vartype == 2 and 1 # Check it's an int/counter
default = '' if len(str(value)) > 31 else value
entry = OrderedDict([ entry = OrderedDict([
('dbms', dbms), ('dbms', dbms),
('name', 'global.{}'.format(name)), ('name', 'global.{}'.format(name)),
('vartype', vartype), ('vartype', vartype),
('default', value), ('default', default),
('summary', summary), ('summary', summary),
('scope', 'global'), ('scope', 'global'),
('metric_type', mettype), ('metric_type', mettype),

View File

@ -227,7 +227,7 @@ class BaseParser:
for target_name, target_instance in target_list.items(): for target_name, target_instance in target_list.items():
metric_data[target_name] = target_instance.compute( metric_data[target_name] = target_instance.compute(
base_metric_data, observation_time) metrics, observation_time)
return metric_data return metric_data

View File

@ -29,10 +29,10 @@ class CustomDBTime(BaseTargetObjective):
total_wait_time += float(value) total_wait_time += float(value)
elif 'time_waited_micro_fg' in name: elif 'time_waited_micro_fg' in name:
wait_time = float(value) wait_time = float(value)
elif name.endswith('wait_class#'): elif name.endswith('wait_class'):
# 0: Other; 1: Application; 2: Configuration; 3: Administrative; 4: Concurrency; # 0: Other; 1: Application; 2: Configuration; 3: Administrative; 4: Concurrency;
# 5: Commit; 6: Idle; 7: Network; 8: User I/O; 9: System I/O # 5: Commit; 6: Idle; 7: Network; 8: User I/O; 9: System I/O
if int(value) == 6: if value == 'Idle':
wait_time = 0 wait_time = 0
total_wait_time += wait_time total_wait_time += wait_time
return total_wait_time / 1000000. return total_wait_time / 1000000.
@ -55,21 +55,22 @@ class NormalizedDBTime(BaseTargetObjective):
continue continue
if 'db cpu' in name: if 'db cpu' in name:
total_wait_time += float(value) total_wait_time += float(value)
elif 'average_wait_fg' in name:
average_wait = MetricCatalog.objects.get(dbms=dbms, name=name).default
average_wait = float(average_wait) * 10000 # unit = micro seconds
elif 'time_waited_micro_fg' in name: elif 'time_waited_micro_fg' in name:
default_wait_time = float(MetricCatalog.objects.get(dbms=dbms, name=name).default)
wait_time = float(value) wait_time = float(value)
elif 'total_waits_fg' in name: elif 'total_waits_fg' in name:
default_total_waits = int(MetricCatalog.objects.get(dbms=dbms, name=name).default)
total_waits = int(value) total_waits = int(value)
elif name.endswith('wait_class#'): elif name.endswith('wait_class'):
value = int(value) if value == 'Idle':
# 0: Other; 1: Application; 2: Configuration; 3: Administrative; 4: Concurrency;
# 5: Commit; 6: Idle; 7: Network; 8: User I/O; 9: System I/O
if value == 6:
wait_time = 0 wait_time = 0
elif value == 8 or value == 9 or any(n in name for n in extra_io_metrics): elif value in ('User I/O', 'System I/O') or \
any(n in name for n in extra_io_metrics):
if not any(n in name for n in not_io_metrics): if not any(n in name for n in not_io_metrics):
if default_total_waits == 0:
average_wait = 0
else:
average_wait = default_wait_time / default_total_waits
wait_time = total_waits * average_wait wait_time = total_waits * average_wait
total_wait_time += wait_time total_wait_time += wait_time
return total_wait_time / 1000000. return total_wait_time / 1000000.
@ -110,7 +111,7 @@ class ElapsedTime(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.dba_hist_sysstat.user commits', BaseThroughput(transactions_counter=('global.dba_hist_sysstat.user commits',
'global.dba_hist_sysstat.user rollbacks')), 'global.dba_hist_sysstat.user rollbacks')),
SummedUpDBTime(), CustomDBTime(),
NormalizedDBTime(), NormalizedDBTime(),
RawDBTime(), RawDBTime(),
TransactionCounter(), TransactionCounter(),