pghero 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pghero might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7180e123821d568de00ca057b46d552b04424cba
4
- data.tar.gz: bcad3bb920aeeedf4958aaaa5a941d3e3af5724d
3
+ metadata.gz: 4c2d5754086d5f05286f922a611306630605f73b
4
+ data.tar.gz: ca7b5dcb1a2e9d58bd54c7aacd0e6994bfd7123e
5
5
  SHA512:
6
- metadata.gz: 1e4eb14518cac12bced82d9ed97bd057be822f1d1f0f8d3ccd011f36f4b5658f749fd689de57ae4bec93433818b5fc9c9d917235b032ed26a7b5e6356557ea09
7
- data.tar.gz: fad8fdc055de2709db694cfdc46be8f52ffe51565945a5e895e56ba9877450f31799af7199338001d61ac806fcaf34b0c7b0ec54a6974496f0db8f52e8353871
6
+ metadata.gz: c1dbde4deefd73421ffa1bb3f8f7bcb55026cd945b2c2ff9add537585d3169b01955c1e50140eec4356406aa1d7a17892b46eb6ca09b3523917b482dac41ad2e
7
+ data.tar.gz: 75c4b1ee8ddcf1d7153df87a1ff0aad0108bad8eded953061c342c66c01313d17f8ee3a19b28d37ef693b567c7dff90c8c111452e8a878d71a24ef5b56604975
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.5.2
2
+
3
+ - Added support for PostgreSQL 9.6
4
+ - Fixed incorrect query start for live queries in transactions
5
+
1
6
  ## 1.5.1
2
7
 
3
8
  - Better tune page for PostgreSQL 9.5
@@ -1,21 +1,19 @@
1
1
  <table class="table queries">
2
2
  <thead>
3
3
  <tr>
4
- <th style="width: 10%;">Pid</th>
5
- <th style="width: 10%;">State</th>
6
- <th style="width: 15%;">Duration</th>
7
- <th>Source</th>
4
+ <th style="width: 25%;">Pid</th>
5
+ <th style="width: 25%;">Duration</th>
6
+ <th style="width: 25%;">State</th>
8
7
  <th style="width: 25%;"></th>
9
8
  </tr>
10
9
  </thead>
11
10
  <tbody>
12
11
  <% now = Time.now %>
13
- <% queries.each do |query| %>
12
+ <% queries.reverse.each do |query| %>
14
13
  <tr>
15
14
  <td><%= query["pid"] %></td>
16
- <td><%= query["state"] %></td>
17
15
  <td><%= query["started_at"] ? "#{number_with_delimiter(((now - Time.parse(query["started_at"])) * 1000).round)} ms" : nil %></td>
18
- <td><%= query["source"] %> <span class="text-muted"><%= query["user"] %></span></td>
16
+ <td><%= query["state"] %></td>
19
17
  <td class="text-right">
20
18
  <% button_path, button_options = Rails.version >= "4.1" ? [explain_path, {params: {query: query["query"]}}] : [explain_path(query: query["query"]), {}] %>
21
19
  <%= button_to "Explain", button_path, button_options.merge(form: {target: "_blank"}, class: "btn btn-info") %>
@@ -23,7 +21,10 @@
23
21
  </td>
24
22
  </tr>
25
23
  <tr>
26
- <td colspan="6" style="border-top: none; padding: 0;"><pre><%= query["query"] %></pre></td>
24
+ <td colspan="6" style="border-top: none; padding: 0;">
25
+ <%= query["source"] %> <span class="text-muted"><%= query["user"] %></span>
26
+ <pre><%= query["query"] %></pre>
27
+ </td>
27
28
  </tr>
28
29
  <% end %>
29
30
  </tbody>
data/guides/Linux.md CHANGED
@@ -21,7 +21,7 @@ Ubuntu 14.04 (Trusty)
21
21
  wget -qO - https://deb.packager.io/key | sudo apt-key add -
22
22
  echo "deb https://deb.packager.io/gh/pghero/pghero trusty master" | sudo tee /etc/apt/sources.list.d/pghero.list
23
23
  sudo apt-get update
24
- sudo apt-get install pghero
24
+ sudo apt-get -y install pghero
25
25
  ```
26
26
 
27
27
  Ubuntu 12.04 (Precise)
@@ -30,7 +30,7 @@ Ubuntu 12.04 (Precise)
30
30
  wget -qO - https://deb.packager.io/key | sudo apt-key add -
31
31
  echo "deb https://deb.packager.io/gh/pghero/pghero precise master" | sudo tee /etc/apt/sources.list.d/pghero.list
32
32
  sudo apt-get update
33
- sudo apt-get install pghero
33
+ sudo apt-get -y install pghero
34
34
  ```
35
35
 
36
36
  Debian 7 (Wheezy)
@@ -39,16 +39,17 @@ Debian 7 (Wheezy)
39
39
  wget -qO - https://deb.packager.io/key | sudo apt-key add -
40
40
  echo "deb https://deb.packager.io/gh/pghero/pghero wheezy master" | sudo tee /etc/apt/sources.list.d/pghero.list
41
41
  sudo apt-get update
42
- sudo apt-get install pghero
42
+ sudo apt-get -y install pghero
43
43
  ```
44
44
 
45
45
  Debian 8 (Jesse)
46
46
 
47
47
  ```sh
48
+ sudo apt-get -y install apt-transport-https
48
49
  wget -qO - https://deb.packager.io/key | sudo apt-key add -
49
50
  echo "deb https://deb.packager.io/gh/pghero/pghero jessie master" | sudo tee /etc/apt/sources.list.d/pghero.list
50
51
  sudo apt-get update
51
- sudo apt-get install pghero
52
+ sudo apt-get -y install pghero
52
53
  ```
53
54
 
54
55
  CentOS / RHEL 6
@@ -1,16 +1,17 @@
1
1
  module PgHero
2
2
  module Methods
3
3
  module Queries
4
- def running_queries
4
+ def running_queries(options = {})
5
+ min_duration = options[:min_duration]
5
6
  select_all <<-SQL
6
7
  SELECT
7
8
  pid,
8
9
  state,
9
10
  application_name AS source,
10
- age(now(), xact_start) AS duration,
11
- waiting,
11
+ age(NOW(), COALESCE(query_start, xact_start)) AS duration,
12
+ #{server_version_num >= 90600 ? "(wait_event IS NOT NULL) AS waiting" : "waiting"},
12
13
  query,
13
- xact_start AS started_at,
14
+ COALESCE(query_start, xact_start) AS started_at,
14
15
  usename AS user
15
16
  FROM
16
17
  pg_stat_activity
@@ -19,33 +20,14 @@ module PgHero
19
20
  AND state <> 'idle'
20
21
  AND pid <> pg_backend_pid()
21
22
  AND datname = current_database()
23
+ #{min_duration ? "AND NOW() - COALESCE(query_start, xact_start) > interval '#{min_duration.to_i} seconds'" : nil}
22
24
  ORDER BY
23
- query_start DESC
25
+ COALESCE(query_start, xact_start) DESC
24
26
  SQL
25
27
  end
26
28
 
27
29
  def long_running_queries
28
- select_all <<-SQL
29
- SELECT
30
- pid,
31
- state,
32
- application_name AS source,
33
- age(now(), xact_start) AS duration,
34
- waiting,
35
- query,
36
- xact_start AS started_at,
37
- usename AS user
38
- FROM
39
- pg_stat_activity
40
- WHERE
41
- query <> '<insufficient privilege>'
42
- AND state <> 'idle'
43
- AND pid <> pg_backend_pid()
44
- AND now() - query_start > interval '#{PgHero.long_running_query_sec.to_i} seconds'
45
- AND datname = current_database()
46
- ORDER BY
47
- query_start DESC
48
- SQL
30
+ running_queries(min_duration: PgHero.long_running_query_sec)
49
31
  end
50
32
 
51
33
  def slow_queries(options = {})
@@ -1,3 +1,3 @@
1
1
  module PgHero
2
- VERSION = "1.5.1"
2
+ VERSION = "1.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pghero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-27 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord