pghero 0.1.3 → 0.1.4

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: 29304eb8bb67300583bfaaffab77dd935b0130ff
4
- data.tar.gz: 25e21952cdc181790541aebfa0ff0367185f2310
3
+ metadata.gz: 42d5f779562b89764cd14697f3929b48407b2902
4
+ data.tar.gz: e89c108a39b3eeb72d8e8c36bcfa83b3243a9410
5
5
  SHA512:
6
- metadata.gz: c4e5849bd8c6cf15d02012be6319353d5239a479de435250273a0abd36cef5e277f4cc9ba4b5408d0508a7990d0839ca47cadd06e6c8b47cb46d26ddd7ea85c6
7
- data.tar.gz: 74edd4e2ac1432ad5793a01ed727c95915563f45bfe7637d0344eb6b32a3ddedd7128f273be91235b4f165c0da59fb2f34ee08b4ab77e004d61108ecfcaeeb0a
6
+ metadata.gz: 9b04c5e26d00034f12600df994dc6b6c86195cf777dbcfd4e552dd10d41020de4747d8f50fea104d595aaa5d8579b9a868124f84c968b6288f107939bf7464b8
7
+ data.tar.gz: 8ab45421d0d4a71e38d26916cef3747f360e581fdf5fd7ef4507ffdbbcc8ad9d374cfc0df772a976a29e36fd01d29365bfe6a8e06071977e929ab9b428b613d3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.1.4
2
+
3
+ - Reduced long running queries threshold to 1 minute
4
+ - Fixed duration
5
+ - Fixed wrapping
6
+ - Friendlier dependencies for JRuby
7
+
1
8
  ## 0.1.3
2
9
 
3
10
  - Reverted `query_stats_available?` fix
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PgHero
2
2
 
3
- Database insights made easy
3
+ Postgres insights made easy
4
4
 
5
5
  [View the demo](https://pghero.herokuapp.com/)
6
6
 
@@ -20,7 +20,7 @@ Add this line to your application’s Gemfile:
20
20
  gem 'pghero'
21
21
  ```
22
22
 
23
- And mount the dashboard in your router.
23
+ And mount the dashboard in your `config/routes.rb`:
24
24
 
25
25
  ```ruby
26
26
  mount PgHero::Engine, at: "pghero"
@@ -74,6 +74,53 @@ authenticate :user, lambda {|user| user.admin? } do
74
74
  end
75
75
  ```
76
76
 
77
+ ## Query Stats
78
+
79
+ The [pg_stat_statements module](http://www.postgresql.org/docs/9.3/static/pgstatstatements.html) is used for query stats.
80
+
81
+ ### Common Issues
82
+
83
+ #### Installation
84
+
85
+ If you have trouble enabling query stats from the dashboard, try doing it manually.
86
+
87
+ Add the following to your `postgresql.conf`:
88
+
89
+ ```conf
90
+ shared_preload_libraries = 'pg_stat_statements'
91
+ pg_stat_statements.track = all
92
+ ```
93
+
94
+ Then restart PostgreSQL. As a superuser from the `psql` console, run:
95
+
96
+ ```psql
97
+ CREATE extension pg_stat_statements;
98
+ ```
99
+
100
+ **Note:** Query stats are not available on Amazon RDS. [Tell Amazon you want this.](https://forums.aws.amazon.com/thread.jspa?messageID=548724)
101
+
102
+ #### pg_stat_statements must be loaded via shared_preload_libraries
103
+
104
+ Follow the instructions above.
105
+
106
+ #### FATAL: could not access file "pg_stat_statements": No such file or directory
107
+
108
+ Run `apt-get install postgresql-contrib-9.3` and follow the instructions above.
109
+
110
+ #### The database user does not have permission to ...
111
+
112
+ The database user is not a superuser. You can manually enable stats from the `psql` console with:
113
+
114
+ ```psql
115
+ CREATE extension pg_stat_statements;
116
+ ```
117
+
118
+ and reset stats with:
119
+
120
+ ```psql
121
+ SELECT pg_stat_statements_reset();
122
+ ```
123
+
77
124
  ## TODO
78
125
 
79
126
  - show exactly which indexes to add
@@ -68,6 +68,7 @@
68
68
  background-color: #ddd;
69
69
  padding: 10px;
70
70
  white-space: pre-wrap;
71
+ word-break: break-word;
71
72
  }
72
73
 
73
74
  textarea {
@@ -16,7 +16,7 @@
16
16
  <td><%= query["state"] %></td>
17
17
  <td><%= query["source"] %></td>
18
18
  <td><%= query["waiting"] == "t" ? "true" : "false" %></td>
19
- <td><% query["started_at"] ? time_ago_in_words(query["started_at"], include_seconds: true) : nil %></td>
19
+ <td><%= query["started_at"] ? time_ago_in_words(query["started_at"], include_seconds: true) : nil %></td>
20
20
  <td class="text-right"><%= button_to "Kill", kill_path(pid: query["pid"]), class: "btn btn-info" %></td>
21
21
  </tr>
22
22
  <tr>
@@ -1,11 +1,4 @@
1
1
  <div id="status">
2
- <div class="alert alert-<%= @query_stats_enabled ? "success" : "warning" %>">
3
- <% if @query_stats_enabled %>
4
- Query stats are enabled
5
- <% else %>
6
- Query stats are not enabled
7
- <% end %>
8
- </div>
9
2
  <div class="alert alert-<%= @query_stats_enabled && @slow_queries.empty? ? "success" : "warning" %>">
10
3
  <% if !@query_stats_enabled %>
11
4
  Query stats must be enabled for slow queries
data/lib/pghero.rb CHANGED
@@ -47,7 +47,7 @@ module PgHero
47
47
  query <> '<insufficient privilege>'
48
48
  AND state <> 'idle'
49
49
  AND pid <> pg_backend_pid()
50
- AND now() - query_start > interval '5 minutes'
50
+ AND now() - query_start > interval '1 minutes'
51
51
  ORDER BY
52
52
  query_start DESC
53
53
  }
@@ -1,3 +1,3 @@
1
1
  module PgHero
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/pghero.gemspec CHANGED
@@ -18,10 +18,15 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "pg"
22
21
  spec.add_dependency "activerecord"
23
22
 
24
23
  spec.add_development_dependency "bundler", "~> 1.6"
25
24
  spec.add_development_dependency "rake"
26
25
  spec.add_development_dependency "minitest"
26
+
27
+ if RUBY_PLATFORM == "java"
28
+ spec.add_development_dependency "activerecord-jdbcpostgresql-adapter"
29
+ else
30
+ spec.add_development_dependency "pg"
31
+ end
27
32
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pghero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-04 00:00:00.000000000 Z
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: pg
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: activerecord
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +66,20 @@ dependencies:
80
66
  - - ">="
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pg
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
83
  description: Database insights made easy
84
84
  email:
85
85
  - andrew@chartkick.com