Module: D13n::Metric::AppStateMetric::GemProcessor

Includes:
Namespace
Defined in:
lib/d13n/metric/metrics/app_state_metric.rb

Instance Method Summary collapse

Methods included from Namespace

#exception_metric_tags, #gem_metric_tags

Instance Method Details

#collect_gem_gauge(named_gem, gauge = 1, rate = 1.0) ⇒ Object



43
44
45
# File 'lib/d13n/metric/metrics/app_state_metric.rb', line 43

def collect_gem_gauge(named_gem,gauge=1, rate=1.0)
  @collector.gauge(metric_name('gauge'), gauge, sample_rate:rate, tags: gem_metric_tags(named_gem))
end

#load_gem_specObject



37
38
39
40
41
# File 'lib/d13n/metric/metrics/app_state_metric.rb', line 37

def load_gem_spec
  Gem.loaded_specs.inject({}) {
    |m, (n,s)| m.merge(n => s.version)
  }
end

#processObject



31
32
33
34
35
# File 'lib/d13n/metric/metrics/app_state_metric.rb', line 31

def process
  load_gem_spec.each do |g| 
    collect_gem_gauge(g)
  end
end