rails_error_dashboard 0.11.6 → 0.11.8
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/db/migrate/20260325000001_fix_swallowed_exceptions_index_for_mysql.rb +7 -0
- data/db/migrate/20260908220001_add_missing_postgresql_indexes_to_error_logs.rb +42 -0
- data/db/migrate/20260909000001_replace_message_gin_with_searchable_text_index.rb +58 -0
- data/lib/rails_error_dashboard/version.rb +1 -1
- data/lib/tasks/error_dashboard.rake +24 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8f2e404fb451057a68a9210eaf1035282a061b1e9cdf1ad22f9831d6c85974a
|
|
4
|
+
data.tar.gz: cd2feb750eb08095785468bdaef7cc5968e197482f735f7b529d971029a12223
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d320b2ab1fa0d4ff60f469d1cc895c52c78645c217a85baf776438b116fdac046b6c9c96645bfea7fb0d6874f0a139028613cecf9d5b7891ef8efa786323888
|
|
7
|
+
data.tar.gz: 82edc71f3850c9d75d8e40afdf9839ad79446537f4334c6c998acce167dcf7ffeccc4863b89f8165263cf4468ce9cba948d802eb9085fa3c6414d046095013a1
|
|
@@ -38,6 +38,13 @@ class FixSwallowedExceptionsIndexForMysql < ActiveRecord::Migration[7.0]
|
|
|
38
38
|
|
|
39
39
|
def down
|
|
40
40
|
return unless table_exists?(:rails_error_dashboard_swallowed_exceptions)
|
|
41
|
+
# The pre-migration shape (500-char locations under a five-column unique
|
|
42
|
+
# index) is exactly what MySQL cannot create — that is why this migration
|
|
43
|
+
# exists — so there is nothing valid to roll back to there.
|
|
44
|
+
if connection.adapter_name.match?(/mysql|trilogy/i)
|
|
45
|
+
raise ActiveRecord::IrreversibleMigration,
|
|
46
|
+
"the previous swallowed_exceptions index exceeds MySQL's 3072-byte key limit; this migration cannot be reversed on MySQL"
|
|
47
|
+
end
|
|
41
48
|
|
|
42
49
|
if index_name_exists?(:rails_error_dashboard_swallowed_exceptions, "index_swallowed_exceptions_upsert_key")
|
|
43
50
|
remove_index :rails_error_dashboard_swallowed_exceptions, name: "index_swallowed_exceptions_upsert_key"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Fresh PostgreSQL installs never got two indexes the query layer was written
|
|
4
|
+
# for: 20251225071314_add_optimized_indexes_to_error_logs returns early once
|
|
5
|
+
# its composite indexes exist, and the squashed first migration creates those
|
|
6
|
+
# composites but not the PostgreSQL-only partial index on unresolved rows or
|
|
7
|
+
# the GIN index behind full-text message search. Existing installs that ran
|
|
8
|
+
# the incremental chain have them; this adds them wherever they are missing.
|
|
9
|
+
# No-op on other adapters.
|
|
10
|
+
class AddMissingPostgresqlIndexesToErrorLogs < ActiveRecord::Migration[7.0]
|
|
11
|
+
TABLE = :rails_error_dashboard_error_logs
|
|
12
|
+
|
|
13
|
+
def up
|
|
14
|
+
return unless postgresql?
|
|
15
|
+
return unless table_exists?(TABLE)
|
|
16
|
+
|
|
17
|
+
unless index_name_exists?(TABLE, "index_error_logs_on_occurred_at_unresolved")
|
|
18
|
+
add_index TABLE, :occurred_at, where: "resolved = false",
|
|
19
|
+
name: "index_error_logs_on_occurred_at_unresolved"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
execute <<-SQL
|
|
23
|
+
CREATE INDEX IF NOT EXISTS index_error_logs_on_message_gin
|
|
24
|
+
ON rails_error_dashboard_error_logs
|
|
25
|
+
USING gin(to_tsvector('english', message))
|
|
26
|
+
SQL
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def down
|
|
30
|
+
return unless postgresql?
|
|
31
|
+
return unless table_exists?(TABLE)
|
|
32
|
+
|
|
33
|
+
remove_index TABLE, name: "index_error_logs_on_occurred_at_unresolved", if_exists: true
|
|
34
|
+
execute "DROP INDEX IF EXISTS index_error_logs_on_message_gin"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def postgresql?
|
|
40
|
+
connection.adapter_name.downcase == "postgresql"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# The dashboard's PostgreSQL full-text search (Queries::ErrorsList#filter_by_search)
|
|
4
|
+
# matches against message, backtrace and error_type together:
|
|
5
|
+
#
|
|
6
|
+
# to_tsvector('english', COALESCE(message, '') || ' ' || COALESCE(backtrace, '') || ' ' || COALESCE(error_type, ''))
|
|
7
|
+
#
|
|
8
|
+
# PostgreSQL uses an expression index only when the query's expression is
|
|
9
|
+
# identical to the index's, so of the two GIN indexes defined over time only
|
|
10
|
+
# one can serve that search:
|
|
11
|
+
#
|
|
12
|
+
# index_error_logs_on_message_gin to_tsvector('english', message) never used by any query
|
|
13
|
+
# index_error_logs_on_searchable_text the expression above the one the search needs
|
|
14
|
+
#
|
|
15
|
+
# Which of them a host has depends on how it was installed. Hosts that ran the
|
|
16
|
+
# incremental chain got both; hosts installed from the squashed first migration
|
|
17
|
+
# got neither (the later index migrations skip themselves once the squash's
|
|
18
|
+
# composite indexes exist), and 0.11.7 then added only the message-only one.
|
|
19
|
+
#
|
|
20
|
+
# This converges every install on index_error_logs_on_searchable_text alone.
|
|
21
|
+
# No-op on other adapters.
|
|
22
|
+
class ReplaceMessageGinWithSearchableTextIndex < ActiveRecord::Migration[7.0]
|
|
23
|
+
TABLE = :rails_error_dashboard_error_logs
|
|
24
|
+
|
|
25
|
+
def up
|
|
26
|
+
return unless postgresql?
|
|
27
|
+
return unless table_exists?(TABLE)
|
|
28
|
+
|
|
29
|
+
execute <<~SQL
|
|
30
|
+
CREATE INDEX IF NOT EXISTS index_error_logs_on_searchable_text
|
|
31
|
+
ON rails_error_dashboard_error_logs
|
|
32
|
+
USING gin(to_tsvector('english',
|
|
33
|
+
COALESCE(message, '') || ' ' || COALESCE(backtrace, '') || ' ' || COALESCE(error_type, '')
|
|
34
|
+
))
|
|
35
|
+
SQL
|
|
36
|
+
|
|
37
|
+
execute "DROP INDEX IF EXISTS index_error_logs_on_message_gin"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def down
|
|
41
|
+
return unless postgresql?
|
|
42
|
+
|
|
43
|
+
# There is no single state to return to: before this migration a host had
|
|
44
|
+
# either both indexes or only the message-only one, depending on its
|
|
45
|
+
# install path. Dropping searchable_text here would take away, on
|
|
46
|
+
# incremental-chain hosts, an index they had before, and nothing needs
|
|
47
|
+
# message_gin back. Earlier gem versions run unchanged against the
|
|
48
|
+
# converged schema.
|
|
49
|
+
raise ActiveRecord::IrreversibleMigration,
|
|
50
|
+
"this migration converges two index layouts (see its header); the previous layout is not recoverable"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def postgresql?
|
|
56
|
+
connection.adapter_name.downcase == "postgresql"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -52,6 +52,30 @@ namespace :error_dashboard do
|
|
|
52
52
|
checks_failed += 1
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
# 3b. MySQL only: named-zone conversion needs the server's time zone
|
|
56
|
+
# tables; without them groupdate (charts, baselines) raises.
|
|
57
|
+
begin
|
|
58
|
+
conn = RailsErrorDashboard::ErrorLogsRecord.connection
|
|
59
|
+
if conn.adapter_name.match?(/mysql|trilogy/i)
|
|
60
|
+
print " MySQL time zone tables... "
|
|
61
|
+
zone = (Time.zone || ActiveSupport::TimeZone["UTC"]).tzinfo.name
|
|
62
|
+
converted = conn.select_value("SELECT CONVERT_TZ(NOW(), '+00:00', #{conn.quote(zone)})")
|
|
63
|
+
if converted.nil?
|
|
64
|
+
puts "MISSING"
|
|
65
|
+
puts " CONVERT_TZ to '#{zone}' returned NULL: the server has no time zone tables,"
|
|
66
|
+
puts " so the dashboard's time-bucketed charts and baselines will raise."
|
|
67
|
+
puts " Fix (on the MySQL server): mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql"
|
|
68
|
+
puts " See docs/guides/DATABASE_OPTIONS.md (MySQL)."
|
|
69
|
+
warnings += 1
|
|
70
|
+
else
|
|
71
|
+
puts "OK (#{zone})"
|
|
72
|
+
checks_passed += 1
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
rescue => e
|
|
76
|
+
puts "SKIPPED (#{e.message.truncate(60)})"
|
|
77
|
+
end
|
|
78
|
+
|
|
55
79
|
# 4. Tables check
|
|
56
80
|
print " Required tables... "
|
|
57
81
|
required_tables = %w[
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_error_dashboard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anjan Jagirdar
|
|
@@ -409,6 +409,8 @@ files:
|
|
|
409
409
|
- db/migrate/20260824000001_add_user_agent_to_rack_attack_events.rb
|
|
410
410
|
- db/migrate/20260826000001_add_environment_to_error_logs.rb
|
|
411
411
|
- db/migrate/20260908000001_add_release_to_error_occurrences.rb
|
|
412
|
+
- db/migrate/20260908220001_add_missing_postgresql_indexes_to_error_logs.rb
|
|
413
|
+
- db/migrate/20260909000001_replace_message_gin_with_searchable_text_index.rb
|
|
412
414
|
- lib/generators/rails_error_dashboard/install/install_generator.rb
|
|
413
415
|
- lib/generators/rails_error_dashboard/install/templates/README
|
|
414
416
|
- lib/generators/rails_error_dashboard/install/templates/initializer.rb
|
|
@@ -577,7 +579,7 @@ metadata:
|
|
|
577
579
|
funding_uri: https://github.com/sponsors/AnjanJ
|
|
578
580
|
post_install_message: |
|
|
579
581
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
580
|
-
RED (Rails Error Dashboard) v0.11.
|
|
582
|
+
RED (Rails Error Dashboard) v0.11.8
|
|
581
583
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
582
584
|
|
|
583
585
|
First install:
|