oracledb_exporter icon indicating copy to clipboard operation
oracledb_exporter copied to clipboard

Where is the actual queries that are running from the default metrics?

Open beefcake8u opened this issue 1 year ago • 1 comments

I'm submitting a Question

  • [X] bug report
  • [ ] feature request I am a DBA - where are the queries for the default metrics located, if you go to default metrics.toml file it only shows 5 or 6 metrics NOT the other 20 or so, Where are these located in order to see for example what the query for oracledb_wait_time_concurrency may be

Version: X.Y.Z

beefcake8u avatar Mar 08 '24 17:03 beefcake8u

Queries in default-metrics.tom utilizes Oracle's dynamic performance views (known as v$ views). These views contain data about the current state of the database, making them extremely useful for monitoring and diagnostics, for example:

SELECT
  n.wait_class as WAIT_CLASS,
  round(m.time_waited/m.INTSIZE_CSEC,3) as VALUE
FROM
  v$waitclassmetric  m, v$system_wait_class n
WHERE
  m.wait_class_id=n.wait_class_id AND n.wait_class != 'Idle'

v$waitclassmetric (alias m): This view provides metrics on wait classes. It includes columns such as wait_class_id and time_waited. v$system_wait_class (alias n): This view describes the various wait classes, such as Concurrency, Administrative, etc. Key columns here are wait_class_id and wait_class. SELECT: The query selects the wait class (wait_class) and calculates the value (VALUE), which is the total wait time divided by the time interval in hundredths of a second (INTSIZE_CSEC), rounded to three decimal places. This provides a measure of the average wait time in that class for the interval. WHERE: The filter condition excludes wait classes classified as Idle. The Idle class generally means that the database processes are not busy executing tasks or waiting for resources; they are idle.

If you run the query from default-metrics.toml manually, you'll see the values you're looking for:

result: WAIT_CLASS VALUE Other 0.001 Application 0 Configuration 0 Administrative 0 Concurrency 0 Commit 0.001 Network 0 User I/O 0 System I/O 0.002

afilippov-re avatar May 13 '24 12:05 afilippov-re