Class: Insight::Instrumentation::PackageDefinition
- Inherits:
-
Object
- Object
- Insight::Instrumentation::PackageDefinition
- Defined in:
- lib/insight/instrumentation/package-definition.rb
Instance Attribute Summary (collapse)
-
- (Object) collector
readonly
Returns the value of attribute collector.
Class Method Summary (collapse)
- + (Object) add_collector(collector)
- + (Object) all_collectors
- + (Object) clear_collectors
- + (Object) probe(collector, &block)
- + (Object) probes
- + (Object) start
Instance Method Summary (collapse)
- - (Object) get_class_probe(name)
- - (Object) get_instance_probe(name)
-
- (PackageDefinition) initialize(collector)
constructor
A new instance of PackageDefinition.
- - (Object) instrument(name, &block)
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 |