rails_pulse 0.1.3 → 0.1.4

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +56 -16
  3. data/Rakefile +169 -86
  4. data/app/controllers/rails_pulse/queries_controller.rb +14 -20
  5. data/app/controllers/rails_pulse/requests_controller.rb +43 -30
  6. data/app/helpers/rails_pulse/breadcrumbs_helper.rb +1 -1
  7. data/app/helpers/rails_pulse/chart_helper.rb +1 -1
  8. data/app/helpers/rails_pulse/formatting_helper.rb +21 -2
  9. data/app/javascript/rails_pulse/controllers/index_controller.js +11 -3
  10. data/app/models/rails_pulse/dashboard/tables/slow_queries.rb +1 -1
  11. data/app/models/rails_pulse/dashboard/tables/slow_routes.rb +1 -1
  12. data/app/models/rails_pulse/queries/cards/average_query_times.rb +1 -1
  13. data/app/models/rails_pulse/queries/cards/execution_rate.rb +56 -17
  14. data/app/models/rails_pulse/queries/cards/percentile_query_times.rb +1 -1
  15. data/app/models/rails_pulse/queries/charts/average_query_times.rb +3 -7
  16. data/app/models/rails_pulse/request.rb +1 -1
  17. data/app/models/rails_pulse/requests/charts/average_response_times.rb +2 -2
  18. data/app/models/rails_pulse/requests/tables/index.rb +77 -0
  19. data/app/models/rails_pulse/routes/cards/average_response_times.rb +1 -1
  20. data/app/models/rails_pulse/routes/cards/error_rate_per_route.rb +1 -1
  21. data/app/models/rails_pulse/routes/cards/percentile_response_times.rb +1 -1
  22. data/app/models/rails_pulse/routes/cards/request_count_totals.rb +16 -5
  23. data/app/models/rails_pulse/routes/tables/index.rb +4 -2
  24. data/app/models/rails_pulse/summary.rb +7 -7
  25. data/app/services/rails_pulse/analysis/query_characteristics_analyzer.rb +11 -3
  26. data/app/views/rails_pulse/components/_metric_card.html.erb +2 -2
  27. data/app/views/rails_pulse/components/_operation_details_popover.html.erb +1 -1
  28. data/app/views/rails_pulse/components/_sparkline_stats.html.erb +1 -1
  29. data/app/views/rails_pulse/dashboard/index.html.erb +1 -1
  30. data/app/views/rails_pulse/queries/_analysis_results.html.erb +53 -23
  31. data/app/views/rails_pulse/queries/_show_table.html.erb +33 -5
  32. data/app/views/rails_pulse/queries/_table.html.erb +3 -7
  33. data/app/views/rails_pulse/requests/_table.html.erb +30 -19
  34. data/app/views/rails_pulse/requests/index.html.erb +8 -0
  35. data/app/views/rails_pulse/requests/show.html.erb +0 -2
  36. data/app/views/rails_pulse/routes/_requests_table.html.erb +39 -0
  37. data/app/views/rails_pulse/routes/_table.html.erb +3 -9
  38. data/app/views/rails_pulse/routes/show.html.erb +3 -5
  39. data/config/initializers/rails_charts_csp_patch.rb +32 -40
  40. data/db/migrate/20250930105043_install_rails_pulse_tables.rb +23 -0
  41. data/db/rails_pulse_schema.rb +1 -1
  42. data/lib/generators/rails_pulse/convert_to_migrations_generator.rb +25 -9
  43. data/lib/generators/rails_pulse/install_generator.rb +9 -5
  44. data/lib/generators/rails_pulse/templates/db/rails_pulse_schema.rb +72 -2
  45. data/lib/generators/rails_pulse/templates/migrations/install_rails_pulse_tables.rb +3 -2
  46. data/lib/generators/rails_pulse/upgrade_generator.rb +2 -1
  47. data/lib/rails_pulse/engine.rb +21 -0
  48. data/lib/rails_pulse/version.rb +1 -1
  49. data/public/rails-pulse-assets/rails-pulse.js +1 -1
  50. data/public/rails-pulse-assets/rails-pulse.js.map +2 -2
  51. metadata +5 -4
  52. data/db/migrate/20241222000001_create_rails_pulse_summaries.rb +0 -54
  53. data/db/migrate/20250916031656_add_analysis_to_rails_pulse_queries.rb +0 -13
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_pulse
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
  - Rails Pulse
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-24 00:00:00.000000000 Z
10
+ date: 2025-10-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -251,6 +251,7 @@ files:
251
251
  - app/models/rails_pulse/request.rb
252
252
  - app/models/rails_pulse/requests/charts/average_response_times.rb
253
253
  - app/models/rails_pulse/requests/charts/operations_chart.rb
254
+ - app/models/rails_pulse/requests/tables/index.rb
254
255
  - app/models/rails_pulse/route.rb
255
256
  - app/models/rails_pulse/routes/cards/average_response_times.rb
256
257
  - app/models/rails_pulse/routes/cards/error_rate_per_route.rb
@@ -307,6 +308,7 @@ files:
307
308
  - app/views/rails_pulse/requests/_table.html.erb
308
309
  - app/views/rails_pulse/requests/index.html.erb
309
310
  - app/views/rails_pulse/requests/show.html.erb
311
+ - app/views/rails_pulse/routes/_requests_table.html.erb
310
312
  - app/views/rails_pulse/routes/_table.html.erb
311
313
  - app/views/rails_pulse/routes/index.html.erb
312
314
  - app/views/rails_pulse/routes/show.html.erb
@@ -318,8 +320,7 @@ files:
318
320
  - config/initializers/rails_charts_csp_patch.rb
319
321
  - config/initializers/rails_pulse.rb
320
322
  - config/routes.rb
321
- - db/migrate/20241222000001_create_rails_pulse_summaries.rb
322
- - db/migrate/20250916031656_add_analysis_to_rails_pulse_queries.rb
323
+ - db/migrate/20250930105043_install_rails_pulse_tables.rb
323
324
  - db/rails_pulse_schema.rb
324
325
  - lib/generators/rails_pulse/convert_to_migrations_generator.rb
325
326
  - lib/generators/rails_pulse/install_generator.rb
@@ -1,54 +0,0 @@
1
- class CreateRailsPulseSummaries < ActiveRecord::Migration[7.1]
2
- def change
3
- create_table :rails_pulse_summaries do |t|
4
- # Time fields
5
- t.datetime :period_start, null: false
6
- t.datetime :period_end, null: false
7
- t.string :period_type, null: false # 'hour', 'day', 'week', 'month'
8
-
9
- # Polymorphic association to handle both routes and queries
10
- t.references :summarizable, polymorphic: true, null: false, index: true
11
- # This creates summarizable_type (e.g., 'RailsPulse::Route', 'RailsPulse::Query')
12
- # and summarizable_id (route_id or query_id)
13
-
14
- # Universal metrics
15
- t.integer :count, default: 0, null: false
16
- t.float :avg_duration
17
- t.float :min_duration
18
- t.float :max_duration
19
- t.float :p50_duration
20
- t.float :p95_duration
21
- t.float :p99_duration
22
- t.float :total_duration
23
- t.float :stddev_duration
24
-
25
- # Request/Route specific metrics
26
- t.integer :error_count, default: 0
27
- t.integer :success_count, default: 0
28
- t.integer :status_2xx, default: 0
29
- t.integer :status_3xx, default: 0
30
- t.integer :status_4xx, default: 0
31
- t.integer :status_5xx, default: 0
32
-
33
- t.timestamps
34
-
35
- # Unique constraint and indexes
36
- t.index [ :summarizable_type, :summarizable_id, :period_type, :period_start ],
37
- unique: true,
38
- name: 'idx_pulse_summaries_unique'
39
- t.index [ :period_type, :period_start ]
40
- t.index :created_at
41
- end
42
-
43
- # Add indexes to existing tables for efficient aggregation
44
- add_index :rails_pulse_requests, [ :created_at, :route_id ],
45
- name: 'idx_requests_for_aggregation'
46
- add_index :rails_pulse_requests, :created_at,
47
- name: 'idx_requests_created_at'
48
-
49
- add_index :rails_pulse_operations, [ :created_at, :query_id ],
50
- name: 'idx_operations_for_aggregation'
51
- add_index :rails_pulse_operations, :created_at,
52
- name: 'idx_operations_created_at'
53
- end
54
- end
@@ -1,13 +0,0 @@
1
- class AddAnalysisToRailsPulseQueries < ActiveRecord::Migration[8.0]
2
- def change
3
- add_column :rails_pulse_queries, :analyzed_at, :datetime, comment: "When query analysis was last performed"
4
- add_column :rails_pulse_queries, :explain_plan, :text, comment: "EXPLAIN output from actual SQL execution"
5
- add_column :rails_pulse_queries, :issues, :text, comment: "JSON array of detected performance issues"
6
- add_column :rails_pulse_queries, :metadata, :text, comment: "JSON object containing query complexity metrics"
7
- add_column :rails_pulse_queries, :query_stats, :text, comment: "JSON object with query characteristics analysis"
8
- add_column :rails_pulse_queries, :backtrace_analysis, :text, comment: "JSON object with call chain and N+1 detection"
9
- add_column :rails_pulse_queries, :suggestions, :text, comment: "JSON array of optimization recommendations"
10
- add_column :rails_pulse_queries, :index_recommendations, :text, comment: "JSON array of database index recommendations"
11
- add_column :rails_pulse_queries, :n_plus_one_analysis, :text, comment: "JSON object with enhanced N+1 query detection results"
12
- end
13
- end