Class: MemHealth::DashboardController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- MemHealth::DashboardController
- Defined in:
- app/controllers/mem_health/dashboard_controller.rb
Instance Method Summary collapse
Instance Method Details
#clear ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/controllers/mem_health/dashboard_controller.rb', line 27 def clear before_stats = MemHealth::Tracker.stats MemHealth::Tracker.clear_all_data redirect_to root_path, notice: "✅ All memory usage statistics have been reset successfully! Cleared #{before_stats[:stored_urls_count]} URLs and reset max memory diff from #{before_stats[:max_memory_diff]} MB to 0.0 MB." rescue StandardError => e redirect_to root_path, alert: "❌ Error clearing memory statistics: #{e.}" end |
#index ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/mem_health/dashboard_controller.rb', line 6 def index @memory_hunter_enabled = MemHealth.configuration.enabled? @view_type = params[:view] || 'web' if @memory_hunter_enabled if @view_type == 'worker' @stats = MemHealth::Tracker.worker_stats @top_items = MemHealth::Tracker.top_memory_jobs @max_memory_item = MemHealth::Tracker.max_memory_job else @stats = MemHealth::Tracker.stats @top_items = MemHealth::Tracker.top_memory_urls @max_memory_item = MemHealth::Tracker.max_memory_url end else @stats = nil @top_items = [] @max_memory_item = nil end end |