Class: Contrast::Extension::Assess::FiberPropagator
- 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
- .track_rb_fiber_new(fiber, _enum, _enum_method, underlying, _underlying_method) ⇒ Object
- .track_rb_fiber_yield(fiber, _method, results) ⇒ Object
Methods included from Components::Logger::InstanceMethods
Methods included from Components::Scope::InstanceMethods
contrast_enter_method_scopes!, contrast_exit_method_scopes!, with_app_scope, with_contrast_scope, with_deserialization_scope, with_split_scope
Class Method Details
.track_rb_fiber_new(fiber, _enum, _enum_method, underlying, _underlying_method) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/contrast/extension/assess/fiber.rb', line 76 def track_rb_fiber_new fiber, _enum, _enum_method, , return unless ::Contrast::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) event_data = Contrast::Agent::Assess::Events::EventData.new(FIBER_NEW_NODE, fiber, , fiber, []) properties.build_event(event_data) 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
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/contrast/extension/assess/fiber.rb', line 56 def track_rb_fiber_yield fiber, _method, results return unless ::Contrast::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| next unless (result_properties = Contrast::Agent::Assess::Tracker.properties!(result)) result_properties.splat_from(fiber, result) event_data = Contrast::Agent::Assess::Events::EventData.new(FIBER_YIELD_NODE, result, fiber, result, []) result_properties.build_event(event_data) end end rescue Exception => e # rubocop:disable Lint/RescueException logger.error('Unable to propagate during Fiber#yield', e) end |