Class: Groonga::QueryLog::Analyzer::Reporter
- Inherits:
-
Object
- Object
- Groonga::QueryLog::Analyzer::Reporter
- Includes:
- Enumerable
- Defined in:
- lib/groonga/query-log/analyzer/reporter.rb
Direct Known Subclasses
ConsoleReporter, HTMLReporter, JSONReporter, JSONStreamReporter
Instance Attribute Summary collapse
-
#output ⇒ Object
Returns the value of attribute output.
-
#slow_operation_threshold ⇒ Object
Returns the value of attribute slow_operation_threshold.
-
#slow_response_threshold ⇒ Object
Returns the value of attribute slow_response_threshold.
Instance Method Summary collapse
- #apply_options(options) ⇒ Object
- #each ⇒ Object
-
#initialize(statistics) ⇒ Reporter
constructor
A new instance of Reporter.
- #report ⇒ Object
- #report_statistics ⇒ Object
Constructor Details
#initialize(statistics) ⇒ Reporter
Returns a new instance of Reporter.
28 29 30 31 32 33 34 35 36 |
# File 'lib/groonga/query-log/analyzer/reporter.rb', line 28 def initialize(statistics) @statistics = statistics @report_summary = true @output = $stdout @slow_operation_threshold = Statistic::DEFAULT_SLOW_OPERATION_THRESHOLD @slow_response_threshold = Statistic::DEFAULT_SLOW_RESPONSE_THRESHOLD end |
Instance Attribute Details
#output ⇒ Object
Returns the value of attribute output.
26 27 28 |
# File 'lib/groonga/query-log/analyzer/reporter.rb', line 26 def output @output end |
#slow_operation_threshold ⇒ Object
Returns the value of attribute slow_operation_threshold.
27 28 29 |
# File 'lib/groonga/query-log/analyzer/reporter.rb', line 27 def slow_operation_threshold @slow_operation_threshold end |
#slow_response_threshold ⇒ Object
Returns the value of attribute slow_response_threshold.
27 28 29 |
# File 'lib/groonga/query-log/analyzer/reporter.rb', line 27 def slow_response_threshold @slow_response_threshold end |
Instance Method Details
#apply_options(options) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/groonga/query-log/analyzer/reporter.rb', line 38 def () self.output = [:output] || @output unless [:report_summary].nil? @report_summary = [:report_summary] end @slow_operation_threshold = [:slow_operation_threshold] || @slow_operation_threshold @slow_response_threshold = [:slow_response_threshold] || @slow_response_threshold end |
#each ⇒ Object
54 55 56 57 58 |
# File 'lib/groonga/query-log/analyzer/reporter.rb', line 54 def each @statistics.each do |statistic| yield statistic end end |
#report ⇒ Object
60 61 62 63 64 65 |
# File 'lib/groonga/query-log/analyzer/reporter.rb', line 60 def report setup do report_summary if @report_summary report_statistics end end |
#report_statistics ⇒ Object
67 68 69 70 71 |
# File 'lib/groonga/query-log/analyzer/reporter.rb', line 67 def report_statistics each do |statistic| report_statistic(statistic) end end |