oracle-db-appdev-monitoring
oracle-db-appdev-monitoring copied to clipboard
Bug in metric definition
Hello,
First of all I would like to thank you for building this product. I would like to raise the problem with one definition of the default metric:
context = "wait_time"
metricsdesc = { value="Generic counter metric from v$waitclassmetric view in Oracle." }
fieldtoappend= "wait_class"
request = '''
SELECT wait_class as WAIT_CLASS, sum(time_waited) as VALUE
FROM gv$active_session_history
where wait_class is not null
and sample_time > sysdate - interval '1' hour
GROUP BY wait_class;
'''
it is using summary of time_waited taken from sampled rows keep by the v$active_session_history view. There is a few issues related to this SQL query:
- sum(time_waited) should not be used from ASH (see page 28 of this Oracle presentation - ASH deep dive
- v$active_session_history view required an Oracle EE edition plus diagnostic pack - this should be mentioned in documentation if you want to keep using it
- using samples for last hour if Prometheus metric scraping is done every 5 sec by default may not be representative
I would propose to use v$system_wait_class (as it was in the initial version of this exporter) and define all metrics as counters ( as this is how they are implemented in v$system_wait_class view).
I am still working on some enhancements of the metrics and if you are ok I can raise a PR request when I am ready.
regards, Marcin
Hi Marcin,
Thank you very much for your input. We'd certainly be happy to accept a PR from you.
Best regards, Mark