rails_error_dashboard 0.2.4 → 0.3.1

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +96 -14
  3. data/app/controllers/rails_error_dashboard/errors_controller.rb +139 -1
  4. data/app/helpers/rails_error_dashboard/application_helper.rb +25 -0
  5. data/app/jobs/rails_error_dashboard/retention_cleanup_job.rb +18 -6
  6. data/app/views/layouts/rails_error_dashboard.html.erb +157 -1
  7. data/app/views/rails_error_dashboard/errors/_breadcrumbs_group.html.erb +236 -0
  8. data/app/views/rails_error_dashboard/errors/_co_occurring_errors.html.erb +70 -0
  9. data/app/views/rails_error_dashboard/errors/_discussion.html.erb +107 -0
  10. data/app/views/rails_error_dashboard/errors/_error_cascades.html.erb +138 -0
  11. data/app/views/rails_error_dashboard/errors/_error_info.html.erb +190 -0
  12. data/app/views/rails_error_dashboard/errors/_modals.html.erb +139 -0
  13. data/app/views/rails_error_dashboard/errors/_pattern_insights.html.erb +1 -1
  14. data/app/views/rails_error_dashboard/errors/_request_context.html.erb +108 -0
  15. data/app/views/rails_error_dashboard/errors/_show_scripts.html.erb +156 -0
  16. data/app/views/rails_error_dashboard/errors/_sidebar_metadata.html.erb +352 -0
  17. data/app/views/rails_error_dashboard/errors/_similar_errors.html.erb +75 -0
  18. data/app/views/rails_error_dashboard/errors/_timeline.html.erb +1 -1
  19. data/app/views/rails_error_dashboard/errors/cache_health_summary.html.erb +143 -0
  20. data/app/views/rails_error_dashboard/errors/database_health_summary.html.erb +450 -0
  21. data/app/views/rails_error_dashboard/errors/deprecations.html.erb +129 -0
  22. data/app/views/rails_error_dashboard/errors/job_health_summary.html.erb +152 -0
  23. data/app/views/rails_error_dashboard/errors/n_plus_one_summary.html.erb +134 -0
  24. data/app/views/rails_error_dashboard/errors/settings.html.erb +17 -0
  25. data/app/views/rails_error_dashboard/errors/show.html.erb +20 -1132
  26. data/config/routes.rb +5 -0
  27. data/db/migrate/20251223000000_create_rails_error_dashboard_complete_schema.rb +6 -0
  28. data/db/migrate/20260303000001_add_breadcrumbs_to_error_logs.rb +9 -0
  29. data/db/migrate/20260304000001_add_system_health_to_error_logs.rb +12 -0
  30. data/lib/generators/rails_error_dashboard/install/install_generator.rb +31 -3
  31. data/lib/generators/rails_error_dashboard/install/templates/initializer.rb +67 -5
  32. data/lib/rails_error_dashboard/commands/log_error.rb +33 -0
  33. data/lib/rails_error_dashboard/configuration.rb +45 -3
  34. data/lib/rails_error_dashboard/engine.rb +6 -1
  35. data/lib/rails_error_dashboard/middleware/error_catcher.rb +8 -0
  36. data/lib/rails_error_dashboard/queries/cache_health_summary.rb +72 -0
  37. data/lib/rails_error_dashboard/queries/database_health_summary.rb +82 -0
  38. data/lib/rails_error_dashboard/queries/deprecation_warnings.rb +80 -0
  39. data/lib/rails_error_dashboard/queries/job_health_summary.rb +101 -0
  40. data/lib/rails_error_dashboard/queries/n_plus_one_summary.rb +83 -0
  41. data/lib/rails_error_dashboard/services/breadcrumb_collector.rb +182 -0
  42. data/lib/rails_error_dashboard/services/cache_analyzer.rb +76 -0
  43. data/lib/rails_error_dashboard/services/curl_generator.rb +80 -0
  44. data/lib/rails_error_dashboard/services/database_health_inspector.rb +168 -0
  45. data/lib/rails_error_dashboard/services/n_plus_one_detector.rb +74 -0
  46. data/lib/rails_error_dashboard/services/rspec_generator.rb +145 -0
  47. data/lib/rails_error_dashboard/services/system_health_snapshot.rb +145 -0
  48. data/lib/rails_error_dashboard/subscribers/breadcrumb_subscriber.rb +210 -0
  49. data/lib/rails_error_dashboard/version.rb +1 -1
  50. data/lib/rails_error_dashboard.rb +24 -0
  51. data/lib/tasks/error_dashboard.rake +68 -2
  52. metadata +33 -2
@@ -127,9 +127,27 @@ namespace :error_dashboard do
127
127
  puts "SKIPPED (#{e.message.truncate(60)})"
128
128
  end
129
129
 
130
- # 7. Authentication check
130
+ # 7. Data retention check
131
+ print " Data retention... "
132
+ if config.retention_days.present?
133
+ puts "OK (#{config.retention_days} days)"
134
+ checks_passed += 1
135
+ else
136
+ if Rails.env.production?
137
+ puts "WARNING - no retention policy (errors kept forever)"
138
+ warnings += 1
139
+ else
140
+ puts "OK (no limit - set retention_days for production)"
141
+ checks_passed += 1
142
+ end
143
+ end
144
+
145
+ # 8. Authentication check
131
146
  print " Authentication... "
132
- if config.dashboard_username == "gandalf" && config.dashboard_password == "youshallnotpass"
147
+ if config.authenticate_with
148
+ puts "OK (custom authentication)"
149
+ checks_passed += 1
150
+ elsif config.dashboard_username == "gandalf" && config.dashboard_password == "youshallnotpass"
133
151
  if Rails.env.production?
134
152
  puts "WARNING - using default credentials in production!"
135
153
  checks_failed += 1
@@ -425,4 +443,52 @@ namespace :error_dashboard do
425
443
 
426
444
  puts "\n" + "=" * 80 + "\n"
427
445
  end
446
+
447
+ desc "Run retention cleanup (delete errors older than retention_days)"
448
+ task retention_cleanup: :environment do
449
+ config = RailsErrorDashboard.configuration
450
+
451
+ puts "\n" + "=" * 80
452
+ puts "RAILS ERROR DASHBOARD - RETENTION CLEANUP"
453
+ puts "=" * 80
454
+
455
+ if config.retention_days.blank?
456
+ puts "\n retention_days is not configured (set it in your initializer)"
457
+ puts "\n" + "=" * 80 + "\n"
458
+ next
459
+ end
460
+
461
+ cutoff = config.retention_days.days.ago
462
+ count = RailsErrorDashboard::ErrorLog.where("occurred_at < ?", cutoff).count
463
+
464
+ puts "\n Retention policy: #{config.retention_days} days"
465
+ puts " Cutoff date: #{cutoff.strftime('%Y-%m-%d %H:%M:%S')}"
466
+ puts " Errors to delete: #{count}"
467
+
468
+ if count.zero?
469
+ puts "\n No errors older than #{config.retention_days} days"
470
+ puts "\n" + "=" * 80 + "\n"
471
+ next
472
+ end
473
+
474
+ print "\n Proceed with deletion? (y/N): "
475
+ confirmation = $stdin.gets.chomp.downcase
476
+
477
+ unless confirmation == "y" || confirmation == "yes"
478
+ puts "\n Cleanup cancelled"
479
+ puts "\n" + "=" * 80 + "\n"
480
+ next
481
+ end
482
+
483
+ puts "\n Deleting errors..."
484
+ start_time = Time.current
485
+ deleted = RailsErrorDashboard::RetentionCleanupJob.new.perform
486
+ elapsed = (Time.current - start_time).round(2)
487
+
488
+ puts "\n Retention cleanup complete!"
489
+ puts " Deleted: #{deleted} errors"
490
+ puts " Time elapsed: #{elapsed} seconds"
491
+
492
+ puts "\n" + "=" * 80 + "\n"
493
+ end
428
494
  end
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.2.4
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anjan Jagirdar
@@ -269,15 +269,30 @@ files:
269
269
  - app/views/layouts/rails_error_dashboard.html.erb
270
270
  - app/views/rails_error_dashboard/error_notification_mailer/error_alert.html.erb
271
271
  - app/views/rails_error_dashboard/error_notification_mailer/error_alert.text.erb
272
+ - app/views/rails_error_dashboard/errors/_breadcrumbs_group.html.erb
273
+ - app/views/rails_error_dashboard/errors/_co_occurring_errors.html.erb
274
+ - app/views/rails_error_dashboard/errors/_discussion.html.erb
275
+ - app/views/rails_error_dashboard/errors/_error_cascades.html.erb
276
+ - app/views/rails_error_dashboard/errors/_error_info.html.erb
272
277
  - app/views/rails_error_dashboard/errors/_error_row.html.erb
278
+ - app/views/rails_error_dashboard/errors/_modals.html.erb
273
279
  - app/views/rails_error_dashboard/errors/_pattern_insights.html.erb
280
+ - app/views/rails_error_dashboard/errors/_request_context.html.erb
281
+ - app/views/rails_error_dashboard/errors/_show_scripts.html.erb
282
+ - app/views/rails_error_dashboard/errors/_sidebar_metadata.html.erb
283
+ - app/views/rails_error_dashboard/errors/_similar_errors.html.erb
274
284
  - app/views/rails_error_dashboard/errors/_source_code.html.erb
275
285
  - app/views/rails_error_dashboard/errors/_stats.html.erb
276
286
  - app/views/rails_error_dashboard/errors/_timeline.html.erb
277
287
  - app/views/rails_error_dashboard/errors/_user_errors_table.html.erb
278
288
  - app/views/rails_error_dashboard/errors/analytics.html.erb
289
+ - app/views/rails_error_dashboard/errors/cache_health_summary.html.erb
279
290
  - app/views/rails_error_dashboard/errors/correlation.html.erb
291
+ - app/views/rails_error_dashboard/errors/database_health_summary.html.erb
292
+ - app/views/rails_error_dashboard/errors/deprecations.html.erb
280
293
  - app/views/rails_error_dashboard/errors/index.html.erb
294
+ - app/views/rails_error_dashboard/errors/job_health_summary.html.erb
295
+ - app/views/rails_error_dashboard/errors/n_plus_one_summary.html.erb
281
296
  - app/views/rails_error_dashboard/errors/overview.html.erb
282
297
  - app/views/rails_error_dashboard/errors/platform_comparison.html.erb
283
298
  - app/views/rails_error_dashboard/errors/settings.html.erb
@@ -309,6 +324,8 @@ files:
309
324
  - db/migrate/20260220000003_add_time_series_indexes_to_error_logs.rb
310
325
  - db/migrate/20260221000001_add_environment_info_to_error_logs.rb
311
326
  - db/migrate/20260221000002_add_reopened_at_to_error_logs.rb
327
+ - db/migrate/20260303000001_add_breadcrumbs_to_error_logs.rb
328
+ - db/migrate/20260304000001_add_system_health_to_error_logs.rb
312
329
  - lib/generators/rails_error_dashboard/install/install_generator.rb
313
330
  - lib/generators/rails_error_dashboard/install/templates/README
314
331
  - lib/generators/rails_error_dashboard/install/templates/initializer.rb
@@ -349,14 +366,19 @@ files:
349
366
  - lib/rails_error_dashboard/plugins/metrics_plugin.rb
350
367
  - lib/rails_error_dashboard/queries/analytics_stats.rb
351
368
  - lib/rails_error_dashboard/queries/baseline_stats.rb
369
+ - lib/rails_error_dashboard/queries/cache_health_summary.rb
352
370
  - lib/rails_error_dashboard/queries/co_occurring_errors.rb
353
371
  - lib/rails_error_dashboard/queries/critical_alerts.rb
354
372
  - lib/rails_error_dashboard/queries/dashboard_stats.rb
373
+ - lib/rails_error_dashboard/queries/database_health_summary.rb
374
+ - lib/rails_error_dashboard/queries/deprecation_warnings.rb
355
375
  - lib/rails_error_dashboard/queries/error_cascades.rb
356
376
  - lib/rails_error_dashboard/queries/error_correlation.rb
357
377
  - lib/rails_error_dashboard/queries/errors_list.rb
358
378
  - lib/rails_error_dashboard/queries/filter_options.rb
379
+ - lib/rails_error_dashboard/queries/job_health_summary.rb
359
380
  - lib/rails_error_dashboard/queries/mttr_stats.rb
381
+ - lib/rails_error_dashboard/queries/n_plus_one_summary.rb
360
382
  - lib/rails_error_dashboard/queries/platform_comparison.rb
361
383
  - lib/rails_error_dashboard/queries/recurring_issues.rb
362
384
  - lib/rails_error_dashboard/queries/similar_errors.rb
@@ -366,8 +388,12 @@ files:
366
388
  - lib/rails_error_dashboard/services/baseline_alert_payload_builder.rb
367
389
  - lib/rails_error_dashboard/services/baseline_alert_throttler.rb
368
390
  - lib/rails_error_dashboard/services/baseline_calculator.rb
391
+ - lib/rails_error_dashboard/services/breadcrumb_collector.rb
392
+ - lib/rails_error_dashboard/services/cache_analyzer.rb
369
393
  - lib/rails_error_dashboard/services/cascade_detector.rb
370
394
  - lib/rails_error_dashboard/services/cause_chain_extractor.rb
395
+ - lib/rails_error_dashboard/services/curl_generator.rb
396
+ - lib/rails_error_dashboard/services/database_health_inspector.rb
371
397
  - lib/rails_error_dashboard/services/discord_payload_builder.rb
372
398
  - lib/rails_error_dashboard/services/environment_snapshot.rb
373
399
  - lib/rails_error_dashboard/services/error_broadcaster.rb
@@ -377,6 +403,7 @@ files:
377
403
  - lib/rails_error_dashboard/services/exception_filter.rb
378
404
  - lib/rails_error_dashboard/services/git_blame_reader.rb
379
405
  - lib/rails_error_dashboard/services/github_link_generator.rb
406
+ - lib/rails_error_dashboard/services/n_plus_one_detector.rb
380
407
  - lib/rails_error_dashboard/services/notification_helpers.rb
381
408
  - lib/rails_error_dashboard/services/notification_throttler.rb
382
409
  - lib/rails_error_dashboard/services/pagerduty_payload_builder.rb
@@ -384,13 +411,16 @@ files:
384
411
  - lib/rails_error_dashboard/services/pearson_correlation.rb
385
412
  - lib/rails_error_dashboard/services/platform_detector.rb
386
413
  - lib/rails_error_dashboard/services/priority_score_calculator.rb
414
+ - lib/rails_error_dashboard/services/rspec_generator.rb
387
415
  - lib/rails_error_dashboard/services/sensitive_data_filter.rb
388
416
  - lib/rails_error_dashboard/services/severity_classifier.rb
389
417
  - lib/rails_error_dashboard/services/similarity_calculator.rb
390
418
  - lib/rails_error_dashboard/services/slack_payload_builder.rb
391
419
  - lib/rails_error_dashboard/services/source_code_reader.rb
392
420
  - lib/rails_error_dashboard/services/statistical_classifier.rb
421
+ - lib/rails_error_dashboard/services/system_health_snapshot.rb
393
422
  - lib/rails_error_dashboard/services/webhook_payload_builder.rb
423
+ - lib/rails_error_dashboard/subscribers/breadcrumb_subscriber.rb
394
424
  - lib/rails_error_dashboard/value_objects/error_context.rb
395
425
  - lib/rails_error_dashboard/version.rb
396
426
  - lib/tasks/error_dashboard.rake
@@ -404,8 +434,9 @@ metadata:
404
434
  changelog_uri: https://github.com/AnjanJ/rails_error_dashboard/blob/main/CHANGELOG.md
405
435
  documentation_uri: https://AnjanJ.github.io/rails_error_dashboard
406
436
  bug_tracker_uri: https://github.com/AnjanJ/rails_error_dashboard/issues
437
+ funding_uri: https://buymeacoffee.com/anjanj
407
438
  post_install_message: "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n
408
- \ Rails Error Dashboard v0.2.4\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n\U0001F195
439
+ \ Rails Error Dashboard v0.3.1\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n\U0001F195
409
440
  First time? Quick start:\n rails generate rails_error_dashboard:install\n rails
410
441
  db:migrate\n # Add to config/routes.rb:\n mount RailsErrorDashboard::Engine
411
442
  => '/error_dashboard'\n\n\U0001F504 Upgrading from v0.1.x?\n rails db:migrate\n