kanshi 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,4 +32,32 @@ SELECT
32
32
  SUM(idx_blks_hit)::bigint AS idx_blks_hit
33
33
  FROM
34
34
  pg_statio_user_tables;
35
+
36
+ SELECT
37
+ COUNT(*) AS locks_waiting
38
+ FROM
39
+ pg_locks
40
+ WHERE
41
+ granted = 'f';
42
+
43
+ SELECT
44
+ EXTRACT('epoch' from SUM(NOW() - xact_start)) AS total_open_xact_time
45
+ FROM
46
+ pg_stat_activity
47
+ WHERE
48
+ xact_start IS NOT NULL;
49
+
50
+ SELECT
51
+ COUNT(*) AS xact_waiting
52
+ FROM
53
+ pg_stat_activity
54
+ WHERE
55
+ waiting = 't';
56
+
57
+ SELECT
58
+ COUNT(*) AS xact_idle
59
+ FROM
60
+ pg_stat_activity
61
+ WHERE
62
+ current_query = '<IDLE> in transaction';
35
63
  EOF
@@ -41,7 +41,12 @@ private
41
41
  hit = data[:blks_hit] || 0
42
42
  read = data[:blks_read] || 0
43
43
  if hit + read > 0
44
- data[:cache_hit_ratio] = 100.0 * hit / (hit + read)
44
+ data[:blks_hit_ratio] = 100.0 * hit / (hit + read)
45
+ end
46
+ hit = data[:heap_blks_hit] || 0
47
+ read = data[:heap_blks_read] || 0
48
+ if hit > 0
49
+ data[:heap_hit_ratio] = 100.0 * (hit - read) / hit
45
50
  end
46
51
  data
47
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: