Class: PgInsights::HealthController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- PgInsights::HealthController
- Defined in:
- app/controllers/pg_insights/health_controller.rb
Instance Method Summary collapse
- #index ⇒ Object
- #missing_indexes ⇒ Object
- #parameter_settings ⇒ Object
- #refresh ⇒ Object
- #sequential_scans ⇒ Object
- #slow_queries ⇒ Object
- #table_bloat ⇒ Object
- #unused_indexes ⇒ Object
Instance Method Details
#index ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/pg_insights/health_controller.rb', line 7 def index @health_results = HealthCheckResult.latest_results @unused_indexes = extract_or_fetch("unused_indexes") { HealthCheckService.check_unused_indexes } @missing_indexes = extract_or_fetch("missing_indexes") { HealthCheckService.check_missing_indexes } @sequential_scans = extract_or_fetch("sequential_scans") { HealthCheckService.check_sequential_scans } @slow_queries = extract_or_fetch("slow_queries") { HealthCheckService.check_slow_queries } @table_bloat = extract_or_fetch("table_bloat") { HealthCheckService.check_table_bloat } @parameter_settings = extract_or_fetch("parameter_settings") { HealthCheckService.check_parameter_settings } refresh_stale_data_async end |
#missing_indexes ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/pg_insights/health_controller.rb', line 30 def missing_indexes result = HealthCheckResult.latest_for_type("missing_indexes") render json: { data: result&.result_data || [], status: result&.status || "pending", executed_at: result&.executed_at, fresh: result&.fresh? || false } end |
#parameter_settings ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/pg_insights/health_controller.rb', line 70 def parameter_settings result = HealthCheckResult.latest_for_type("parameter_settings") render json: { data: result&.result_data || [], status: result&.status || "pending", executed_at: result&.executed_at, fresh: result&.fresh? || false } end |
#refresh ⇒ Object
80 81 82 83 |
# File 'app/controllers/pg_insights/health_controller.rb', line 80 def refresh HealthCheckService.refresh_all! render json: { message: "Health checks queued for refresh" } end |
#sequential_scans ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/pg_insights/health_controller.rb', line 40 def sequential_scans result = HealthCheckResult.latest_for_type("sequential_scans") render json: { data: result&.result_data || [], status: result&.status || "pending", executed_at: result&.executed_at, fresh: result&.fresh? || false } end |
#slow_queries ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/pg_insights/health_controller.rb', line 50 def slow_queries result = HealthCheckResult.latest_for_type("slow_queries") render json: { data: result&.result_data || [], status: result&.status || "pending", executed_at: result&.executed_at, fresh: result&.fresh? || false } end |
#table_bloat ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/pg_insights/health_controller.rb', line 60 def table_bloat result = HealthCheckResult.latest_for_type("table_bloat") render json: { data: result&.result_data || [], status: result&.status || "pending", executed_at: result&.executed_at, fresh: result&.fresh? || false } end |
#unused_indexes ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/pg_insights/health_controller.rb', line 20 def unused_indexes result = HealthCheckResult.latest_for_type("unused_indexes") render json: { data: result&.result_data || [], status: result&.status || "pending", executed_at: result&.executed_at, fresh: result&.fresh? || false } end |