Class: Contrast::Extension::Assess::FiberPropagator
- Includes:
- Components::Interface
- Defined in:
- lib/contrast/extension/assess/fiber.rb,
ext/cs__assess_fiber_track/cs__assess_fiber_track.c
Overview
This Class provides us with a way to invoke Regexp propagation for those methods which are too complex to fit into one of the standard Contrast::Agent::Assess::Policy::Propagator molds without cluttering up the Fiber Class or exposing our methods there.
Class Method Summary collapse
- .instrument_fiber_track ⇒ Object
- .track_rb_fiber_new(fiber, _enum, _enum_method, underlying, _underlying_method) ⇒ Object
- .track_rb_fiber_yield(fiber, _method, results) ⇒ Object
Methods included from Components::Interface
Class Method Details
.instrument_fiber_track ⇒ Object
100 101 102 103 104 105 106 107 108 |
# File 'lib/contrast/extension/assess/fiber.rb', line 100 def instrument_fiber_track @_instrument_fiber_variables ||= begin require 'cs__assess_fiber_track/cs__assess_fiber_track' if Funchook.available? true end rescue StandardError, LoadError => e logger.error('Error loading fiber track patch', e) false end |
.track_rb_fiber_new(fiber, _enum, _enum_method, underlying, _underlying_method) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/contrast/extension/assess/fiber.rb', line 80 def track_rb_fiber_new fiber, _enum, _enum_method, , return unless ASSESS.enabled? return unless .is_a?(String) && !.empty? with_contrast_scope do properties = Contrast::Agent::Assess::Tracker.properties(fiber) return unless properties properties.splat_from(, fiber) properties.build_event( FIBER_NEW_NODE, fiber, , fiber, []) end rescue Exception => e # rubocop:disable Lint/RescueException logger.error('Unable to propagate during Fiber.new', e) end |
.track_rb_fiber_yield(fiber, _method, results) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/contrast/extension/assess/fiber.rb', line 55 def track_rb_fiber_yield fiber, _method, results return unless ASSESS.enabled? # results will be nil if StopIteration was raised, # otherwise an Array of the yielded arguments return unless results.cs__is_a?(Array) with_contrast_scope do results.each do |result| result_properties = Contrast::Agent::Assess::Tracker.properties(result) next unless result_properties result_properties.splat_from(fiber, result) result_properties.build_event( FIBER_YIELD_NODE, result, fiber, result, []) end end rescue Exception => e # rubocop:disable Lint/RescueException logger.error('Unable to propagate during Fiber#yield', e) end |