Gauge Overrides

From zzat
Jump to: navigation, search

Gauge overrides allow you to alter the thresholds used by the gauge columns when the row values match a certain predicate. As with gauge columns, the data type of the override value must match the corresponding column in the gauge query.

Rendering

Continuing where we left off with gauge ignores, gauge overrides are also injected into the gauge query at run time. If we continue from the previous example which shows the gauge query with the columns and ignore values already rendered in:

select * from (
select * from (
select z.begin_time, z.snap#, s.username, w.sid, w.event, round(count(*) over (partition by w.event) / count(*) over (partition by null),2)*100 as pct_sess,
       case when substr(w.event, 1,6) = 'latch:' then 1 else 0 end as is_latch
  from sys.v_$session s, zz$ses_wait w, zz$snap z
 where s.sid = w.sid
   and w.snap# = z.snap#
   and s.username is not null
) where EVENT != :ZZ$BIEVENT1
) where /* gauge col 1 */PCT_SESS > :ZZ$BCPCT_SESS1 and /* gauge col 2 */IS_LATCH = :ZZ$BCIS_LATCH2

If we then add an override for gauge column 1 to say that if the event is a specific event we want to alert if the threshold is at 30% of the sessions instead of the 50% used by the standard gauge column; this then results in the following query:

select * from (
select * from (
select z.begin_time, z.snap#, s.username, w.sid, w.event, round(count(*) over (partition by w.event) / count(*) over (partition by null),2)*100 as pct_sess,
       case when substr(w.event, 1,6) = 'latch:' then 1 else 0 end as is_latch
  from sys.v_$session s, zz$ses_wait w, zz$snap z
 where s.sid = w.sid
   and w.snap# = z.snap#
   and s.username is not null
) where EVENT != :ZZ$BIEVENT1
) )
where
  ( /* override LIBCACHE_OR */
    (
      EVENT = :ZZ$ICEVENT1
      and PCT_SESS > :ZZ$OCPCT_SESS1
    )
    or (
      EVENT != :ZZ$ICEVENT1
      and PCT_SESS > :ZZ$BCPCT_SESS1
    )
  )
  and
  /* gauge col 2 */
  IS_LATCH = :ZZ$BCIS_LATCH2

The final query above is then executed by the GAUGE process to analyze the results.