Class: RailsErrorDashboard::ErrorsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RailsErrorDashboard::ErrorsController
- Defined in:
- app/controllers/rails_error_dashboard/errors_controller.rb
Constant Summary collapse
- FILTERABLE_PARAMS =
%i[ error_type unresolved platform application_id search severity timeframe frequency status assigned_to assignee_name priority_level hide_snoozed hide_muted reopened user_id app_version git_sha sort_by sort_direction ].freeze
Instance Method Summary collapse
- #actioncable_health_summary ⇒ Object
- #activestorage_health_summary ⇒ Object
- #ai_help ⇒ Object
- #analytics ⇒ Object
-
#assign ⇒ Object
Phase 3: Workflow Integration Actions (via Commands).
- #batch_action ⇒ Object
- #cache_health_summary ⇒ Object
- #correlation ⇒ Object
- #create_diagnostic_dump ⇒ Object
- #create_issue ⇒ Object
- #database_health_summary ⇒ Object
- #deprecations ⇒ Object
- #diagnostic_dumps ⇒ Object
- #disable_coverage ⇒ Object
- #enable_coverage ⇒ Object
- #index ⇒ Object
- #job_health_summary ⇒ Object
- #link_issue ⇒ Object
- #llm_health_summary ⇒ Object
- #mute ⇒ Object
- #n_plus_one_summary ⇒ Object
- #overview ⇒ Object
- #platform_comparison ⇒ Object
- #rack_attack_summary ⇒ Object
- #releases ⇒ Object
- #resolve ⇒ Object
- #settings ⇒ Object
- #show ⇒ Object
- #snooze ⇒ Object
- #storms ⇒ Object
- #swallowed_exceptions ⇒ Object
- #test_error ⇒ Object
- #unassign ⇒ Object
- #unmute ⇒ Object
- #unsnooze ⇒ Object
- #update_priority ⇒ Object
- #update_status ⇒ Object
- #user_impact ⇒ Object
Instance Method Details
#actioncable_health_summary ⇒ Object
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 507 def actioncable_health_summary unless RailsErrorDashboard.configuration.enable_actioncable_tracking && RailsErrorDashboard.configuration. flash[:alert] = "ActionCable tracking is not enabled. Enable enable_actioncable_tracking and enable_breadcrumbs in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days result = Queries::ActionCableSummary.call(days, application_id: @current_application_id) all_channels = result[:channels] # Summary stats (computed before pagination) @unique_channels = all_channels.size @total_events = all_channels.sum { |c| c[:total_events] } @total_rejections = all_channels.sum { |c| c[:rejection_count] } @pagy, @channels = pagy(:offset, all_channels, limit: params[:per_page] || 25) end |
#activestorage_health_summary ⇒ Object
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 548 def activestorage_health_summary unless RailsErrorDashboard.configuration.enable_activestorage_tracking && RailsErrorDashboard.configuration. flash[:alert] = "ActiveStorage tracking is not enabled. Enable enable_activestorage_tracking and enable_breadcrumbs in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days result = Queries::ActiveStorageSummary.call(days, application_id: @current_application_id) all_services = result[:services] # Summary stats (computed before pagination) @unique_services = all_services.size @total_operations = all_services.sum { |s| s[:total_operations] } @errors_with_storage = all_services.sum { |s| s[:error_count] } @pagy, @services = pagy(:offset, all_services, limit: params[:per_page] || 25) end |
#ai_help ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 177 def ai_help unless RailsErrorDashboard.configuration.llm_configured? render json: { error: "AI Help is not configured" }, status: :not_found return end question = params[:question].to_s.strip if question.blank? render json: { error: "Question cannot be blank" }, status: :unprocessable_entity return end if question.length > 4000 render json: { error: "Question is too long. Keep it under 4,000 characters." }, status: :unprocessable_entity return end error = ErrorLog.includes(:comments, :parent_cascade_patterns, :child_cascade_patterns).find(params[:id]) = error.(limit: 5, application_id: @current_application_id) context = Services::MarkdownErrorFormatter.call(error, related_errors: ) response.headers["Content-Type"] = "text/event-stream" response.headers["Cache-Control"] = "no-cache" response.headers["X-Accel-Buffering"] = "no" self.response_body = Enumerator.new do |stream| begin result = Services::LlmClient.stream(error: error, question: question, context: context) do |text| stream << sse_event("chunk", text: text) end stream << sse_event("done", result) rescue Services::LlmClient::ConfigurationError, Services::LlmClient::RequestError => e stream << sse_event("error", error: e.) end end end |
#analytics ⇒ Object
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 214 def analytics days = days_param(default: 30) @days = days # Use Query to get analytics data (pass application filter) analytics = Queries::AnalyticsStats.call(days, application_id: @current_application_id) @error_stats = analytics[:error_stats] @errors_over_time = analytics[:errors_over_time] @errors_by_type = analytics[:errors_by_type] @errors_by_platform = analytics[:errors_by_platform] @errors_by_hour = analytics[:errors_by_hour] @top_users = analytics[:top_users] @resolution_rate = analytics[:resolution_rate] @mobile_errors = analytics[:mobile_errors] @api_errors = analytics[:api_errors] # Get recurring issues data (pass application filter) recurring = Queries::RecurringIssues.call(days, application_id: @current_application_id) @recurring_data = recurring # Get release correlation data (pass application filter) correlation = Queries::ErrorCorrelation.new(days: days, application_id: @current_application_id) @errors_by_version = correlation.errors_by_version @problematic_releases = correlation.problematic_releases @release_comparison = calculate_release_comparison # Get MTTR data (pass application filter) mttr_data = Queries::MttrStats.call(days, application_id: @current_application_id) @mttr_stats = mttr_data @overall_mttr = mttr_data[:overall_mttr] @mttr_by_platform = mttr_data[:mttr_by_platform] end |
#assign ⇒ Object
Phase 3: Workflow Integration Actions (via Commands)
113 114 115 116 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 113 def assign @error = Commands::AssignError.call(params[:id], assigned_to: params[:assigned_to]) redirect_to error_path(@error, **app_context_params) end |
#batch_action ⇒ Object
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 272 def batch_action error_ids = params[:error_ids] || [] action_type = params[:action_type] result = case action_type when "resolve" Commands::BatchResolveErrors.call( error_ids, resolved_by_name: params[:resolved_by_name], resolution_comment: params[:resolution_comment] ) when "mute" Commands::BatchMuteErrors.call(error_ids, muted_by: params[:muted_by], reason: params[:reason]) when "unmute" Commands::BatchUnmuteErrors.call(error_ids) when "delete" Commands::BatchDeleteErrors.call(error_ids) else { success: false, count: 0, errors: [ "Invalid action type" ] } end if result[:success] flash[:notice] = "Successfully #{action_type}d #{result[:count]} error(s)" else flash[:alert] = "Batch operation failed: #{result[:errors].join(', ')}" end redirect_to errors_path(**app_context_params) end |
#cache_health_summary ⇒ Object
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 389 def cache_health_summary unless RailsErrorDashboard.configuration. flash[:alert] = "Breadcrumbs are not enabled. Enable them in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days result = Queries::CacheHealthSummary.call(days, application_id: @current_application_id) all_entries = result[:entries] # Summary stats (computed before pagination) @errors_with_cache = all_entries.size non_nil_rates = all_entries.map { |e| e[:hit_rate] }.compact @avg_hit_rate = non_nil_rates.any? ? (non_nil_rates.sum / non_nil_rates.size).round(1) : nil @total_cache_ops = all_entries.sum { |e| e[:reads] + e[:writes] } @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25) end |
#correlation ⇒ Object
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 302 def correlation # Check if feature is enabled unless RailsErrorDashboard.configuration.enable_error_correlation flash[:alert] = "Error Correlation is not enabled. Enable it in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days correlation = Queries::ErrorCorrelation.new(days: days, application_id: @current_application_id) @errors_by_version = correlation.errors_by_version @errors_by_git_sha = correlation.errors_by_git_sha @problematic_releases = correlation.problematic_releases @multi_error_users = correlation.multi_error_users(min_error_types: 2) @time_correlated_errors = correlation. @period_comparison = correlation.period_comparison @platform_specific_errors = correlation.platform_specific_errors end |
#create_diagnostic_dump ⇒ Object
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 583 def create_diagnostic_dump unless RailsErrorDashboard.configuration.enable_diagnostic_dump flash[:alert] = "Diagnostic dumps are not enabled." redirect_to errors_path(**app_context_params) return end dump = Services::DiagnosticDumpGenerator.call app_name = RailsErrorDashboard.configuration.application_name || ENV["APPLICATION_NAME"] || (defined?(Rails) && Rails.application.class.module_parent_name) || "Unknown" app = Commands::FindOrCreateApplication.call(app_name) DiagnosticDump.create!( application_id: app.id, dump_data: dump.to_json, captured_at: Time.current, note: params[:note].presence ) flash[:notice] = "Diagnostic dump captured successfully." redirect_to diagnostic_dumps_errors_path rescue => e flash[:alert] = "Failed to capture diagnostic dump: #{e.}" redirect_to diagnostic_dumps_errors_path end |
#create_issue ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 153 def create_issue dashboard_url = error_url(params[:id]) result = Commands::CreateIssue.call(params[:id], dashboard_url: dashboard_url) if result[:success] flash[:notice] = "Issue created successfully" flash[:new_issue_url] = result[:issue_url] else flash[:alert] = "Failed to create issue: #{result[:error]}" end redirect_to error_path(params[:id], anchor: "issue-tracking", **app_context_params) end |
#database_health_summary ⇒ Object
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 430 def database_health_summary unless RailsErrorDashboard.configuration.enable_system_health flash[:alert] = "System health is not enabled. Enable it in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days # Live database health (display-time only) @live_health = Services::DatabaseHealthInspector.call # Separate host vs gem tables from live data all_tables = @live_health[:tables] || [] @host_tables = all_tables.reject { |t| t[:gem_table] } @gem_tables = all_tables.select { |t| t[:gem_table] } # Historical connection pool stats result = Queries::DatabaseHealthSummary.call(days, application_id: @current_application_id) all_entries = result[:entries] # Summary stats (computed before pagination) @errors_with_pool = all_entries.size @max_utilization = all_entries.map { |e| e[:utilization] }.max || 0 @total_dead = all_entries.sum { |e| e[:dead] } @total_waiting = all_entries.sum { |e| e[:waiting] } @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25) end |
#deprecations ⇒ Object
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 349 def deprecations unless RailsErrorDashboard.configuration. flash[:alert] = "Breadcrumbs are not enabled. Enable them in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days result = Queries::DeprecationWarnings.call(days, application_id: @current_application_id) all_deprecations = result[:deprecations] # Summary stats (computed before pagination) @unique_count = all_deprecations.size @total_count = all_deprecations.sum { |d| d[:count] } @affected_count = all_deprecations.flat_map { |d| d[:error_ids] }.uniq.size @pagy, @deprecations = pagy(:offset, all_deprecations, limit: params[:per_page] || 25) end |
#diagnostic_dumps ⇒ Object
569 570 571 572 573 574 575 576 577 578 579 580 581 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 569 def diagnostic_dumps unless RailsErrorDashboard.configuration.enable_diagnostic_dump flash[:alert] = "Diagnostic dumps are not enabled. Enable them in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end scope = DiagnosticDump.recent scope = scope.where(application_id: @current_application_id) if @current_application_id.present? @total_dumps = scope.count @pagy, @dumps = pagy(:offset, scope, limit: params[:per_page] || 25) end |
#disable_coverage ⇒ Object
627 628 629 630 631 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 627 def disable_coverage Services::CoverageTracker.disable! flash[:notice] = "Code path coverage disabled." redirect_back fallback_location: errors_path end |
#enable_coverage ⇒ Object
612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 612 def enable_coverage unless RailsErrorDashboard.configuration.enable_coverage_tracking flash[:alert] = "Coverage tracking is not enabled in configuration." redirect_to errors_path(**app_context_params) return end if Services::CoverageTracker.enable! flash[:notice] = "Code path coverage enabled. Reproduce the error, then view source code to see executed lines." else flash[:alert] = "Could not enable coverage. Requires Ruby 3.2+." end redirect_back fallback_location: errors_path end |
#index ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 63 def index # Use Query to get filtered errors errors_query = Queries::ErrorsList.call(filter_params) # Paginate with Pagy. raise_range_error makes pagy 43.x raise Pagy::RangeError # on out-of-range pages (e.g. ?page=999999) so application_controller.rb's # rescue_from can redirect to a valid page. Without this, pagy 43.x silently # returns an empty result and users see "All clear!" instead of their data. @pagy, @errors = pagy(:offset, errors_query, limit: params[:per_page] || 25, raise_range_error: true) # Get dashboard stats using Query (pass application filter) @stats = Queries::DashboardStats.call(application_id: @current_application_id) # Get filter options using Query (pass application filter) = Queries::FilterOptions.call(application_id: @current_application_id) @error_types = [:error_types] @platforms = [:platforms] @assignees = [:assignees] end |
#job_health_summary ⇒ Object
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 410 def job_health_summary unless RailsErrorDashboard.configuration.enable_system_health flash[:alert] = "System health is not enabled. Enable it in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days result = Queries::JobHealthSummary.call(days, application_id: @current_application_id) all_entries = result[:entries] # Summary stats (computed before pagination) @errors_with_jobs = all_entries.size @total_failed = all_entries.sum { |e| e[:failed] || e[:errored] || 0 } @adapters_detected = all_entries.map { |e| e[:adapter] }.uniq @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25) end |
#link_issue ⇒ Object
166 167 168 169 170 171 172 173 174 175 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 166 def link_issue result = Commands::LinkExistingIssue.call(params[:id], issue_url: params[:issue_url]) if result[:success] flash[:notice] = "Issue linked successfully" else flash[:alert] = "Failed to link issue: #{result[:error]}" end redirect_to error_path(params[:id], anchor: "issue-tracking", **app_context_params) end |
#llm_health_summary ⇒ Object
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 528 def llm_health_summary unless RailsErrorDashboard.configuration.enable_llm_observability && RailsErrorDashboard.configuration. @feature_disabled = true @days = days_param(default: 30) @models = [] @totals = Queries::LlmHealthSummary.blank_totals @pagy = nil return end days = days_param(default: 30) @days = days result = Queries::LlmHealthSummary.call(days, application_id: @current_application_id) @totals = result[:totals] all_models = result[:models] @pagy, @models = pagy(:offset, all_models, limit: params[:per_page] || 25) end |
#mute ⇒ Object
138 139 140 141 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 138 def mute @error = Commands::MuteError.call(params[:id], muted_by: params[:muted_by], reason: params[:reason]) redirect_to error_path(@error, **app_context_params) end |
#n_plus_one_summary ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 369 def n_plus_one_summary unless RailsErrorDashboard.configuration. flash[:alert] = "Breadcrumbs are not enabled. Enable them in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days result = Queries::NplusOneSummary.call(days, application_id: @current_application_id) all_patterns = result[:patterns] # Summary stats (computed before pagination) @unique_count = all_patterns.size @total_count = all_patterns.sum { |p| p[:count] } @affected_count = all_patterns.flat_map { |p| p[:error_ids] }.uniq.size @pagy, @patterns = pagy(:offset, all_patterns, limit: params[:per_page] || 25) end |
#overview ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 33 def overview # Get dashboard stats using Query (pass application filter) @stats = Queries::DashboardStats.call(application_id: @current_application_id) # Get platform health summary (if enabled, pass application filter) if RailsErrorDashboard.configuration.enable_platform_comparison comparison = Queries::PlatformComparison.new(days: 7, application_id: @current_application_id) @platform_health = comparison.platform_health_summary @platform_scores = comparison.platform_stability_scores else @platform_health = {} @platform_scores = {} end # Get correlation summary (if enabled, pass application filter) if RailsErrorDashboard.configuration.enable_error_correlation correlation = Queries::ErrorCorrelation.new(days: 7, application_id: @current_application_id) @problematic_releases = correlation.problematic_releases.first(3) @time_correlated_errors = correlation..first(3) @multi_error_users = correlation.multi_error_users(min_error_types: 2).first(5) else @problematic_releases = [] @time_correlated_errors = [] @multi_error_users = [] end # Get critical alerts using Query @critical_alerts = Queries::CriticalAlerts.call(application_id: @current_application_id) end |
#platform_comparison ⇒ Object
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 248 def platform_comparison # Check if feature is enabled unless RailsErrorDashboard.configuration.enable_platform_comparison flash[:alert] = "Platform Comparison is not enabled. Enable it in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 7) @days = days # Use Query to get platform comparison data (pass application filter) comparison = Queries::PlatformComparison.new(days: days, application_id: @current_application_id) @error_rate_by_platform = comparison.error_rate_by_platform @severity_distribution = comparison.severity_distribution_by_platform @resolution_times = comparison.resolution_time_by_platform @top_errors_by_platform = comparison.top_errors_by_platform @stability_scores = comparison.platform_stability_scores @cross_platform_errors = comparison.cross_platform_errors @daily_trends = comparison.daily_trend_by_platform @platform_health = comparison.platform_health_summary end |
#rack_attack_summary ⇒ Object
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 486 def rack_attack_summary unless RailsErrorDashboard.configuration.enable_rack_attack_tracking && RailsErrorDashboard.configuration. flash[:alert] = "Rack Attack tracking is not enabled. Enable enable_rack_attack_tracking and enable_breadcrumbs in config/initializers/rails_error_dashboard.rb" redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days result = Queries::RackAttackSummary.call(days, application_id: @current_application_id) all_events = result[:events] # Summary stats (computed before pagination) @unique_rules = all_events.size @total_events = all_events.sum { |e| e[:count] } @unique_ips = all_events.flat_map { |e| e[:ips] }.uniq.size @pagy, @events = pagy(:offset, all_events, limit: params[:per_page] || 25) end |
#releases ⇒ Object
323 324 325 326 327 328 329 330 331 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 323 def releases days = days_param(default: 30) @days = days result = Queries::ReleaseTimeline.call(days, application_id: @current_application_id) all_releases = result[:releases] @summary = result[:summary] @pagy, @releases = pagy(:offset, all_releases, limit: params[:per_page] || 25) end |
#resolve ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 99 def resolve # Use Command to resolve error @error = Commands::ResolveError.call( params[:id], resolved_by_name: params[:resolved_by_name], resolution_comment: params[:resolution_comment], resolution_reference: params[:resolution_reference] ) redirect_to error_path(@error, **app_context_params) end |
#settings ⇒ Object
650 651 652 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 650 def settings @config = RailsErrorDashboard.configuration end |
#show ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 83 def show # Eagerly load associations to avoid N+1 queries # - comments: Audit trail (workflow comments from snooze/mute/status changes) # - parent_cascade_patterns/child_cascade_patterns: Used if cascade detection is enabled @error = ErrorLog.includes(:comments, :parent_cascade_patterns, :child_cascade_patterns).find(params[:id]) @related_errors = @error.(limit: 5, application_id: @current_application_id) @error_markdown = Services::MarkdownErrorFormatter.call(@error, related_errors: @related_errors) # Fetch platform issue state and comments if linked @platform_issue = fetch_platform_issue(@error) @platform_comments = fetch_platform_comments(@error) # Dispatch plugin event for error viewed RailsErrorDashboard::PluginRegistry.dispatch(:on_error_viewed, @error) end |
#snooze ⇒ Object
128 129 130 131 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 128 def snooze @error = Commands::SnoozeError.call(params[:id], hours: params[:hours].to_i, reason: params[:reason]) redirect_to error_path(@error, **app_context_params) end |
#storms ⇒ Object
333 334 335 336 337 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 333 def storms result = Queries::StormHistory.call @active_storm = result[:active] @storm_events = result[:events] end |
#swallowed_exceptions ⇒ Object
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 461 def swallowed_exceptions unless RailsErrorDashboard.configuration.detect_swallowed_exceptions # On Ruby < 3.3, validate! auto-disables this feature — tell the user why if RUBY_VERSION < "3.3" flash[:alert] = "Swallowed exception detection requires Ruby 3.3+ (you have #{RUBY_VERSION}). Upgrade Ruby to use this feature." else flash[:alert] = "Swallowed exception detection is not enabled. Enable it in config/initializers/rails_error_dashboard.rb" end redirect_to errors_path(**app_context_params) return end days = days_param(default: 30) @days = days result = Queries::SwallowedExceptionSummary.call(days, application_id: @current_application_id) all_entries = result[:entries] # Summary stats (computed before pagination) @unique_count = all_entries.size @total_rescue_count = all_entries.sum { |e| e[:rescue_count] } @total_raise_count = all_entries.sum { |e| e[:raise_count] } @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25) end |
#test_error ⇒ Object
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 633 def test_error exception = RailsErrorDashboard::TestError.new( "[RED Test] This is a test error sent from the dashboard to verify " \ "that error capture and notification delivery are working correctly. " \ "It is safe to resolve or delete this error." ) exception.set_backtrace(caller) Commands::LogError.call(exception, { request: request, source: "dashboard.test_error" }) flash[:notice] = "Test error logged successfully. Check your notification channels (Slack, Discord, email, etc.) to confirm delivery." redirect_to errors_path(**app_context_params) rescue => e flash[:alert] = "Failed to log test error: #{e.}" redirect_to settings_path(**app_context_params) end |
#unassign ⇒ Object
118 119 120 121 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 118 def unassign @error = Commands::UnassignError.call(params[:id]) redirect_to error_path(@error, **app_context_params) end |
#unmute ⇒ Object
143 144 145 146 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 143 def unmute @error = Commands::UnmuteError.call(params[:id]) redirect_to error_path(@error, **app_context_params) end |
#unsnooze ⇒ Object
133 134 135 136 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 133 def unsnooze @error = Commands::UnsnoozeError.call(params[:id]) redirect_to error_path(@error, **app_context_params) end |
#update_priority ⇒ Object
123 124 125 126 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 123 def update_priority @error = Commands::UpdateErrorPriority.call(params[:id], priority_level: params[:priority_level]) redirect_to error_path(@error, **app_context_params) end |
#update_status ⇒ Object
148 149 150 151 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 148 def update_status result = Commands::UpdateErrorStatus.call(params[:id], status: params[:status], comment: params[:comment]) redirect_to error_path(result[:error], **app_context_params) end |
#user_impact ⇒ Object
339 340 341 342 343 344 345 346 347 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 339 def user_impact days = days_param(default: 30) @days = days result = Queries::UserImpactSummary.call(days, application_id: @current_application_id) all_entries = result[:entries] @summary = result[:summary] @pagy, @entries = pagy(:offset, all_entries, limit: params[:per_page] || 25) end |