Module: Kolekti

Defined in:
lib/kolekti.rb,
lib/kolekti/errors.rb,
lib/kolekti/parser.rb,
lib/kolekti/runner.rb,
lib/kolekti/version.rb,
lib/kolekti/collector.rb,
lib/kolekti/persistence_strategy.rb,
lib/kolekti/memory_persistence_strategy.rb

Defined Under Namespace

Classes: Collector, CollectorError, KolektiError, MemoryPersistenceStrategy, Parser, PersistenceStrategy, Runner, UnavailableMetricError

Constant Summary collapse

COLLECTORS =
[]
VERSION =
"1.1.3"

Class Method Summary collapse

Class Method Details

.collectorsObject



16
17
18
# File 'lib/kolekti.rb', line 16

def self.collectors
  COLLECTORS
end

.default_metric_value(metric_configuration) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/kolekti.rb', line 26

def self.default_metric_value(metric_configuration)
  metric = metric_configuration.metric

  collector = collectors.find { |coll| coll.name == metric.metric_collector_name }
  return nil if collector.nil?

  collector.default_value_from(metric_configuration)
end

.deregister_collector(collector) ⇒ Object

Raises:

  • (ArgumentError)


20
21
22
23
24
# File 'lib/kolekti.rb', line 20

def self.deregister_collector(collector)
  to_be_deregistered_index = COLLECTORS.find_index { |kollector| kollector.is_a?(collector) }
  raise ArgumentError.new("Collector #{collector} was not registered!") if to_be_deregistered_index.nil?
  COLLECTORS.delete_at(to_be_deregistered_index)
end

.register_collector(collector) ⇒ Object



12
13
14
# File 'lib/kolekti.rb', line 12

def self.register_collector(collector)
  COLLECTORS << collector.new if collector.available? && !already_included?(collector)
end