pghero 2.8.2 → 2.8.3
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/app/views/layouts/pg_hero/application.html.erb +7 -2
- data/app/views/pg_hero/home/_live_queries_table.html.erb +10 -8
- data/lib/pghero/methods/system.rb +31 -5
- data/lib/pghero/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0ef604cc8c9d99ad4c990aff2b2ee6686dcfe8ba43e1b57a5babab2a4f3613d
|
4
|
+
data.tar.gz: d1d6e6b002e0f0ba4c574ecf9cdc4b6953ea89e03215f05529a217fac1228f8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6999c79d2cf479bce29e06e7dda24e635e95173281ee7231c9af1c777871df3d8b271e38b4adb4baa8ca508aaeeb2f07f8c61ae2cf66ca475e1dc0b6603d34e6
|
7
|
+
data.tar.gz: 12fa2e5b15cb1150c51e4076a6c1c68bf55a429de833ed9809a92c46d18a945766a08b348bf4398d893521cd20e297b9c97b3418c0565a259a3c01a077645252
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 2.8.3 (2022-05-01)
|
2
|
+
|
3
|
+
- Added support for `google-apis-monitoring_v3`
|
4
|
+
- Added experimental support for Propshaft
|
5
|
+
- Fixed error with walsender queries on live queries page
|
6
|
+
|
1
7
|
## 2.8.2 (2021-12-15)
|
2
8
|
|
3
9
|
- Fixed sorting by name on space page when historical space stats are not enabled
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ A performance dashboard for Postgres
|
|
8
8
|
|
9
9
|
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
|
10
10
|
|
11
|
-
[![Build Status](https://github.com/ankane/pghero/workflows/build/badge.svg?branch=master)](https://github.com/ankane/pghero/actions) [![Docker Pulls](https://img.shields.io/docker/pulls/ankane/pghero)](https://hub.docker.com/
|
11
|
+
[![Build Status](https://github.com/ankane/pghero/workflows/build/badge.svg?branch=master)](https://github.com/ankane/pghero/actions) [![Docker Pulls](https://img.shields.io/docker/pulls/ankane/pghero)](https://hub.docker.com/r/ankane/pghero)
|
12
12
|
|
13
13
|
## Documentation
|
14
14
|
|
@@ -5,8 +5,13 @@
|
|
5
5
|
|
6
6
|
<meta charset="utf-8" />
|
7
7
|
<%= favicon_link_tag "pghero/favicon.png" %>
|
8
|
-
|
9
|
-
|
8
|
+
<% if defined?(Propshaft::Railtie) %>
|
9
|
+
<%= stylesheet_link_tag "pghero/nouislider", "pghero/arduino-light", "pghero/application" %>
|
10
|
+
<%= javascript_include_tag "pghero/jquery", "pghero/nouislider", "pghero/Chart.bundle", "pghero/chartkick", "pghero/highlight.pack", "pghero/application" %>
|
11
|
+
<% else %>
|
12
|
+
<%= stylesheet_link_tag "pghero/application" %>
|
13
|
+
<%= javascript_include_tag "pghero/application" %>
|
14
|
+
<% end %>
|
10
15
|
</head>
|
11
16
|
<body>
|
12
17
|
<div class="container">
|
@@ -12,14 +12,16 @@
|
|
12
12
|
<tr>
|
13
13
|
<td><%= query[:pid] %></td>
|
14
14
|
<td>
|
15
|
-
<%
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<%
|
22
|
-
|
15
|
+
<% if query[:duration_ms] %>
|
16
|
+
<% sec = query[:duration_ms] / 1000.0 %>
|
17
|
+
<% if sec < 1.minute %>
|
18
|
+
<%= sec.round(1) %> s
|
19
|
+
<% elsif sec < 1.day %>
|
20
|
+
<%= Time.at(sec).utc.strftime("%H:%M:%S") %>
|
21
|
+
<% else %>
|
22
|
+
<% days = (sec / 1.day).floor %>
|
23
|
+
<%= days %>d <%= Time.at(sec - days.days).utc.strftime("%H:%M:%S") %>
|
24
|
+
<% end %>
|
23
25
|
<% end %>
|
24
26
|
</td>
|
25
27
|
<td>
|
@@ -133,8 +133,6 @@ module PgHero
|
|
133
133
|
private
|
134
134
|
|
135
135
|
def gcp_stats(metric_name, duration: nil, period: nil, offset: nil, series: false)
|
136
|
-
require "google/cloud/monitoring/v3"
|
137
|
-
|
138
136
|
# TODO DRY with RDS stats
|
139
137
|
duration = (duration || 1.hour).to_i
|
140
138
|
period = (period || 1.minute).to_i
|
@@ -146,10 +144,20 @@ module PgHero
|
|
146
144
|
raise Error, "Invalid metric name" unless metric_name =~ /\A[a-z\/_]+\z/i
|
147
145
|
raise Error, "Invalid database id" unless gcp_database_id =~ /\A[a-z0-9\-:]+\z/i
|
148
146
|
|
149
|
-
# we handle
|
147
|
+
# we handle four situations:
|
150
148
|
# 1. google-cloud-monitoring-v3
|
151
149
|
# 2. google-cloud-monitoring >= 1
|
152
150
|
# 3. google-cloud-monitoring < 1
|
151
|
+
# 4. google-apis-monitoring_v3
|
152
|
+
begin
|
153
|
+
require "google/cloud/monitoring/v3"
|
154
|
+
rescue LoadError
|
155
|
+
begin
|
156
|
+
require "google/cloud/monitoring"
|
157
|
+
rescue LoadError
|
158
|
+
require "google/apis/monitoring_v3"
|
159
|
+
end
|
160
|
+
end
|
153
161
|
|
154
162
|
# for situations 1 and 2
|
155
163
|
# Google::Cloud::Monitoring.metric_service is documented
|
@@ -175,7 +183,7 @@ module PgHero
|
|
175
183
|
view: Google::Cloud::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView::FULL,
|
176
184
|
aggregation: aggregation
|
177
185
|
})
|
178
|
-
|
186
|
+
elsif defined?(Google::Cloud::Monitoring)
|
179
187
|
require "google/cloud/monitoring"
|
180
188
|
|
181
189
|
client = Google::Cloud::Monitoring::Metric.new
|
@@ -198,13 +206,31 @@ module PgHero
|
|
198
206
|
Google::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView::FULL,
|
199
207
|
aggregation: aggregation
|
200
208
|
)
|
209
|
+
else
|
210
|
+
client = Google::Apis::MonitoringV3::MonitoringService.new
|
211
|
+
|
212
|
+
scope = Google::Apis::MonitoringV3::AUTH_MONITORING_READ
|
213
|
+
client.authorization = Google::Auth.get_application_default([scope])
|
214
|
+
|
215
|
+
# default logging is very verbose, but use app default
|
216
|
+
results = client.list_project_time_series(
|
217
|
+
"projects/#{gcp_database_id.split(":").first}",
|
218
|
+
filter: "metric.type = \"cloudsql.googleapis.com/database/#{metric_name}\" AND resource.label.database_id = \"#{gcp_database_id}\"",
|
219
|
+
interval_start_time: (start_time - period).iso8601,
|
220
|
+
interval_end_time: end_time.iso8601,
|
221
|
+
view: 0, # full
|
222
|
+
aggregation_alignment_period: "#{period}s",
|
223
|
+
aggregation_per_series_aligner: 12 # mean
|
224
|
+
).time_series
|
201
225
|
end
|
202
226
|
|
203
227
|
data = {}
|
204
228
|
result = results.first
|
205
229
|
if result
|
206
230
|
result.points.each do |point|
|
207
|
-
time =
|
231
|
+
time = point.interval.start_time
|
232
|
+
# string with google-apis-monitoring_v3
|
233
|
+
time = time.is_a?(String) ? Time.parse(time) : Time.at(time.seconds)
|
208
234
|
value = point.value.double_value
|
209
235
|
value *= 100 if metric_name == "cpu/utilization"
|
210
236
|
data[time] = value
|
data/lib/pghero/version.rb
CHANGED
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: 2.8.
|
4
|
+
version: 2.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
126
|
+
rubygems_version: 3.3.7
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: A performance dashboard for Postgres
|