pg_insights 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/pg_insights/timeline_controller.rb +1 -1
- data/app/jobs/pg_insights/application_job.rb +5 -0
- data/app/jobs/pg_insights/database_snapshot_job.rb +0 -2
- data/app/jobs/pg_insights/health_check_job.rb +0 -6
- data/app/jobs/pg_insights/health_check_scheduler_job.rb +0 -2
- data/app/jobs/pg_insights/recurring_health_checks_job.rb +0 -2
- data/app/models/pg_insights/health_check_result.rb +6 -2
- data/lib/pg_insights/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8acfcade3c12305c32746590f4a929658316db90b6a447eafed0571acd3376a4
|
4
|
+
data.tar.gz: 718ebc8fc2c8488d7fc17658e204c7c4f2b1b26742013f804649b2ff6ca47136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f88375655df7257c743c72ebb210d7e17a446d8b12c8b29e36eed0cae4c6b8f4a036e0010207db67950a108df2752f69dee5f6f9afc099563c1ddf33c477691
|
7
|
+
data.tar.gz: f97b5851eea169936254692c0ab5b8cd7104e367294b77179c697552ef1c5b6815a0ac5e5cc2a3f919faf0c3f4fed540f94e6bcaa39aef8b39a9c09a55a6c421
|
@@ -13,7 +13,7 @@ module PgInsights
|
|
13
13
|
|
14
14
|
@snapshots = HealthCheckResult.snapshots(90)
|
15
15
|
@parameter_changes = HealthCheckResult.detect_parameter_changes_since(30)
|
16
|
-
@timeline_data = HealthCheckResult.timeline_data(30)
|
16
|
+
@timeline_data = HealthCheckResult.timeline_data(30, @parameter_changes)
|
17
17
|
@stats = calculate_timeline_stats(@snapshots)
|
18
18
|
end
|
19
19
|
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
module PgInsights
|
4
4
|
class HealthCheckJob < ApplicationJob
|
5
|
-
queue_as -> { PgInsights.background_job_queue }
|
6
|
-
|
7
5
|
rescue_from(StandardError) do |exception|
|
8
6
|
Rails.logger.error "PgInsights::HealthCheckJob failed: #{exception.message}"
|
9
7
|
end
|
@@ -26,10 +24,6 @@ module PgInsights
|
|
26
24
|
end
|
27
25
|
end
|
28
26
|
|
29
|
-
def self.queue_name
|
30
|
-
PgInsights.background_job_queue
|
31
|
-
end
|
32
|
-
|
33
27
|
def self.perform_check(check_type, options = {})
|
34
28
|
return false unless PgInsights.background_jobs_available?
|
35
29
|
|
@@ -121,19 +121,23 @@ module PgInsights
|
|
121
121
|
deleted_count
|
122
122
|
end
|
123
123
|
|
124
|
-
def self.timeline_data(days = 30)
|
124
|
+
def self.timeline_data(days = 30, parameter_changes = nil)
|
125
125
|
snapshots = by_type("database_snapshot")
|
126
126
|
.successful
|
127
127
|
.where("executed_at >= ?", days.days.ago)
|
128
128
|
.order(:executed_at)
|
129
129
|
|
130
|
+
build_timeline_data(snapshots, parameter_changes || detect_parameter_changes_since(days))
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.build_timeline_data(snapshots, parameter_changes)
|
130
134
|
{
|
131
135
|
dates: snapshots.map { |s| s.executed_at.strftime("%Y-%m-%d %H:%M") },
|
132
136
|
cache_hit_rates: snapshots.map { |s| (s.result_data.dig("metrics", "cache_hit_rate") || 0).to_f },
|
133
137
|
avg_query_times: snapshots.map { |s| (s.result_data.dig("metrics", "avg_query_time") || 0).to_f },
|
134
138
|
bloated_tables: snapshots.map { |s| (s.result_data.dig("metrics", "bloated_tables") || 0).to_i },
|
135
139
|
total_connections: snapshots.map { |s| (s.result_data.dig("metrics", "total_connections") || 0).to_i },
|
136
|
-
parameter_changes:
|
140
|
+
parameter_changes: parameter_changes
|
137
141
|
}
|
138
142
|
end
|
139
143
|
|
data/lib/pg_insights/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_insights
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mezbah Alam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|