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 environment 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
- BATCH_OUTCOMES =
Batch action param => the key naming its outcome. English happens to form all four by adding "d"/"ed"; most languages do not, so each outcome is named rather than derived from the param.
{ "resolve" => "resolved", "mute" => "muted", "unmute" => "unmuted", "delete" => "deleted" }.freeze
- AI_HELP_QUESTION_LIMIT =
Named once: the check and the message that reports it were both writing 4000, and the copy that drifts is the one the user reads.
4000- INITIALIZER_PATH =
The initializer every "not enabled" notice points at. A path, not prose.
"config/initializers/rails_error_dashboard.rb"
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
Methods inherited from ApplicationController
Methods included from Translation
Instance Method Details
#actioncable_health_summary ⇒ Object
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 551 def actioncable_health_summary unless RailsErrorDashboard.configuration.enable_actioncable_tracking && RailsErrorDashboard.configuration. flash[:alert] = ("actioncable", options: "enable_actioncable_tracking and enable_breadcrumbs") 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
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 592 def activestorage_health_summary unless RailsErrorDashboard.configuration.enable_activestorage_tracking && RailsErrorDashboard.configuration. flash[:alert] = ("activestorage", options: "enable_activestorage_tracking and enable_breadcrumbs") 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
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 196 def ai_help unless RailsErrorDashboard.configuration.llm_configured? render json: { error: red_t("red.flash.ai_help.not_configured") }, status: :not_found return end question = params[:question].to_s.strip if question.blank? render json: { error: red_t("red.flash.ai_help.blank_question") }, status: :unprocessable_entity return end if question.length > AI_HELP_QUESTION_LIMIT render json: { error: red_t("red.flash.ai_help.question_too_long", limit: helpers.number_with_delimiter(AI_HELP_QUESTION_LIMIT)) }, 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
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 236 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_environment = analytics[:errors_by_environment] @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)
132 133 134 135 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 132 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
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 295 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: [ red_t("red.commands.invalid_action") ] } end if result[:success] # One key per outcome rather than "Successfully #{action_type}d": the # original conjugated English past tense by appending a "d" to the raw # param, which no other language can be asked to do. # # An unrecognized action cannot reach here (the case above returns # success: false), but the lookup still degrades rather than raising — # a flash message is never worth a 500 on the error dashboard. outcome = BATCH_OUTCOMES[action_type] flash[:notice] = if outcome red_tp("red.flash.batch.#{outcome}", count: result[:count]) else red_t("red.commands.invalid_action") end else flash[:alert] = red_t("red.flash.batch.failed", reason: result[:errors].join(", ")) end redirect_to errors_path(**app_context_params) end |
#cache_health_summary ⇒ Object
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 424 def cache_health_summary unless RailsErrorDashboard.configuration. flash[:alert] = ("breadcrumbs", plural: true) 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
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 337 def correlation # Check if feature is enabled unless RailsErrorDashboard.configuration.enable_error_correlation flash[:alert] = ("error_correlation") 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
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 627 def create_diagnostic_dump unless RailsErrorDashboard.configuration.enable_diagnostic_dump flash[:alert] = red_t("red.flash.diagnostic_dump.disabled") 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] = red_t("red.flash.diagnostic_dump.captured") redirect_to diagnostic_dumps_errors_path rescue => e flash[:alert] = red_t("red.flash.diagnostic_dump.failed", message: e.) redirect_to diagnostic_dumps_errors_path end |
#create_issue ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 172 def create_issue dashboard_url = error_url(params[:id]) result = Commands::CreateIssue.call(params[:id], dashboard_url: dashboard_url) if result[:success] flash[:notice] = red_t("red.flash.issue.created") flash[:new_issue_url] = result[:issue_url] else flash[:alert] = red_t("red.flash.issue.create_failed", reason: result[:error]) end redirect_to error_path(params[:id], anchor: "issue-tracking", **app_context_params) end |
#database_health_summary ⇒ Object
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 465 def database_health_summary unless RailsErrorDashboard.configuration.enable_system_health flash[:alert] = ("system_health") 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
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 384 def deprecations unless RailsErrorDashboard.configuration. flash[:alert] = ("breadcrumbs", plural: true) 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
613 614 615 616 617 618 619 620 621 622 623 624 625 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 613 def diagnostic_dumps unless RailsErrorDashboard.configuration.enable_diagnostic_dump flash[:alert] = ("diagnostic_dumps", plural: true) 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
671 672 673 674 675 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 671 def disable_coverage Services::CoverageTracker.disable! flash[:notice] = red_t("red.flash.coverage.disabled") redirect_back fallback_location: errors_path end |
#enable_coverage ⇒ Object
656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 656 def enable_coverage unless RailsErrorDashboard.configuration.enable_coverage_tracking flash[:alert] = red_t("red.flash.coverage.not_enabled") redirect_to errors_path(**app_context_params) return end if Services::CoverageTracker.enable! flash[:notice] = red_t("red.flash.coverage.enabled") else flash[:alert] = red_t("red.flash.coverage.unavailable") end redirect_back fallback_location: errors_path end |
#index ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 81 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] @environments = [:environments] @assignees = [:assignees] end |
#job_health_summary ⇒ Object
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 445 def job_health_summary unless RailsErrorDashboard.configuration.enable_system_health flash[:alert] = ("system_health") 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
185 186 187 188 189 190 191 192 193 194 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 185 def link_issue result = Commands::LinkExistingIssue.call(params[:id], issue_url: params[:issue_url]) if result[:success] flash[:notice] = red_t("red.flash.issue.linked") else flash[:alert] = red_t("red.flash.issue.link_failed", reason: result[:error]) end redirect_to error_path(params[:id], anchor: "issue-tracking", **app_context_params) end |
#llm_health_summary ⇒ Object
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 572 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
157 158 159 160 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 157 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
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 404 def n_plus_one_summary unless RailsErrorDashboard.configuration. flash[:alert] = ("breadcrumbs", plural: true) 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
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 51 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
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 271 def platform_comparison # Check if feature is enabled unless RailsErrorDashboard.configuration.enable_platform_comparison flash[:alert] = ("platform_comparison") 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
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 521 def rack_attack_summary unless RailsErrorDashboard.configuration.enable_rack_attack_tracking flash[:alert] = ("rack_attack", options: "enable_rack_attack_tracking = true", set: true) redirect_to errors_path(**app_context_params) return end # Distinguishes "gem not installed" from "installed but no rules matched" # in the empty state — both otherwise render an identical blank page. @rack_attack_missing = !defined?(::Rack::Attack) 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 # Events matched by a recognised AI agent. Counts requests, not addresses — # one agent rotates through many IPs, so unique_ips overstates it (#170). @ai_events = all_events.sum { |e| e[:ai_count].to_i } # Counts the tracker's LRU eviction dropped; shown so the totals above are # never silently understated. @overflow_count = result[:overflow_count].to_i @pagy, @events = pagy(:offset, all_events, limit: params[:per_page] || 25) end |
#releases ⇒ Object
358 359 360 361 362 363 364 365 366 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 358 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
118 119 120 121 122 123 124 125 126 127 128 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 118 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
694 695 696 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 694 def settings @config = RailsErrorDashboard.configuration end |
#show ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 102 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
147 148 149 150 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 147 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
368 369 370 371 372 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 368 def storms result = Queries::StormHistory.call @active_storm = result[:active] @storm_events = result[:events] end |
#swallowed_exceptions ⇒ Object
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 496 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] = red_t("red.flash.swallowed_requires_ruby", version: RUBY_VERSION) else flash[:alert] = ("swallowed_exceptions") 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
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 677 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] = red_t("red.flash.test_error.logged") redirect_to errors_path(**app_context_params) rescue => e flash[:alert] = red_t("red.flash.test_error.failed", message: e.) redirect_to settings_path(**app_context_params) end |
#unassign ⇒ Object
137 138 139 140 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 137 def unassign @error = Commands::UnassignError.call(params[:id]) redirect_to error_path(@error, **app_context_params) end |
#unmute ⇒ Object
162 163 164 165 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 162 def unmute @error = Commands::UnmuteError.call(params[:id]) redirect_to error_path(@error, **app_context_params) end |
#unsnooze ⇒ Object
152 153 154 155 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 152 def unsnooze @error = Commands::UnsnoozeError.call(params[:id]) redirect_to error_path(@error, **app_context_params) end |
#update_priority ⇒ Object
142 143 144 145 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 142 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
167 168 169 170 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 167 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
374 375 376 377 378 379 380 381 382 |
# File 'app/controllers/rails_error_dashboard/errors_controller.rb', line 374 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 |