Class: RailsPulse::Analysis::ExplainPlanAnalyzer

Inherits:
BaseAnalyzer
  • Object
show all
Defined in:
app/services/rails_pulse/analysis/explain_plan_analyzer.rb

Constant Summary collapse

EXPLAIN_TIMEOUT =
5.seconds

Instance Attribute Summary

Attributes inherited from BaseAnalyzer

#operations, #query

Instance Method Summary collapse

Methods inherited from BaseAnalyzer

#initialize

Constructor Details

This class inherits a constructor from RailsPulse::Analysis::BaseAnalyzer

Instance Method Details

#analyzeObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/rails_pulse/analysis/explain_plan_analyzer.rb', line 8

def analyze
  return { explain_plan: nil, issues: [] } if recent_operations.empty?

  actual_sql = recent_operations.first.label
  explain_plan = generate_explain_plan(actual_sql)

  {
    explain_plan: explain_plan,
    issues: detect_explain_issues(explain_plan)
  }
end