class MetricFu::HotspotsGenerator

Public Class Methods

metric() click to toggle source
# File lib/metric_fu/metrics/hotspots/generator.rb, line 4
def self.metric
  :hotspots
end
new(options = {}) click to toggle source
Calls superclass method MetricFu::Generator::new
# File lib/metric_fu/metrics/hotspots/generator.rb, line 8
def initialize(options = {})
  MetricFu::Metric.enabled_metrics.each do |metric|
    require_hotspot(metric.name)
  end
  super
end

Public Instance Methods

analyze() click to toggle source
# File lib/metric_fu/metrics/hotspots/generator.rb, line 19
def analyze
  analyzer = MetricFu::HotspotAnalyzer.new(MetricFu.result.result_hash)
  @hotspots = analyzer.hotspots
end
emit() click to toggle source
# File lib/metric_fu/metrics/hotspots/generator.rb, line 15
def emit
  # no-op
end
to_h() click to toggle source
# File lib/metric_fu/metrics/hotspots/generator.rb, line 24
def to_h
  result = { hotspots: {} }
  @hotspots.each do |granularity, hotspots|
    result[:hotspots][granularity.to_s] = hotspots.map(&:to_hash)
  end
  result
end

Private Instance Methods

require_hotspot(metric_name) click to toggle source
# File lib/metric_fu/metrics/hotspots/generator.rb, line 34
def require_hotspot(metric_name)
  require "metric_fu/metrics/#{metric_name}/hotspot"
rescue LoadError
  mf_debug "*** No hotspot for #{metric_name}"
end