Class: Insight::Instrumentation::PackageDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/insight/instrumentation/package-definition.rb

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (PackageDefinition) initialize(collector)

A new instance of PackageDefinition



46
47
48
# File 'lib/insight/instrumentation/package-definition.rb', line 46

def initialize(collector)
  @collector = collector
end

Instance Attribute Details

- (Object) collector (readonly)

Returns the value of attribute collector



50
51
52
# File 'lib/insight/instrumentation/package-definition.rb', line 50

def collector
  @collector
end

Class Method Details

+ (Object) add_collector(collector)



25
26
27
28
29
# File 'lib/insight/instrumentation/package-definition.rb', line 25

def add_collector(collector)
  unless all_collectors.include?(collector)
    all_collectors << collector
  end
end

+ (Object) all_collectors



21
22
23
# File 'lib/insight/instrumentation/package-definition.rb', line 21

def all_collectors
  @all_collectors ||= []
end

+ (Object) clear_collectors



17
18
19
# File 'lib/insight/instrumentation/package-definition.rb', line 17

def clear_collectors
  all_collectors.clear
end

+ (Object) probe(collector, &block)



31
32
33
34
35
# File 'lib/insight/instrumentation/package-definition.rb', line 31

def probe(collector, &block)
  add_collector(collector)
  definer = self.new(collector)
  definer.instance_eval &block
end

+ (Object) probes



13
14
15
# File 'lib/insight/instrumentation/package-definition.rb', line 13

def probes
  InstanceProbe.all_probes + ClassProbe.all_probes
end

+ (Object) start



4
5
6
7
8
9
10
11
# File 'lib/insight/instrumentation/package-definition.rb', line 4

def start
  @started = begin
               probes.each do |probe|
                 probe.fulfill_probe_orders
               end
               true
             end
end

Instance Method Details

- (Object) get_class_probe(name)



38
39
40
# File 'lib/insight/instrumentation/package-definition.rb', line 38

def get_class_probe(name)
  ClassProbe.probe_for(name)
end

- (Object) get_instance_probe(name)



42
43
44
# File 'lib/insight/instrumentation/package-definition.rb', line 42

def get_instance_probe(name)
  InstanceProbe.probe_for(name)
end

- (Object) instrument(name, &block)



52
53
54
55
56
# File 'lib/insight/instrumentation/package-definition.rb', line 52

def instrument(name, &block)
  definer = ProbeDefinition.new(self, name)
  definer.instance_eval(&block) unless block.nil?
  return definer
end