Module: Threatstack::Instrumentation::Frameworks::TSRandom
- Defined in:
- lib/instrumentation/frameworks/random.rb
Constant Summary collapse
- METHOD_NAMES =
methods to wrap
['rand'].freeze
- @@logger =
Threatstack::Utils::TSLogger.create 'RandomINST'
Class Method Summary collapse
Class Method Details
.wrap_methods ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/instrumentation/frameworks/random.rb', line 16 def self.wrap_methods # executed every time a wrapped method is called on_method_call = Proc.new do |params| module_name, method_name, file_path, line_num, args = Threatstack::Instrumentation.extract_instrumentation_params params # create and queue the event Threatstack::Instrumentation.create_instrumentation_event(module_name, method_name, file_path, line_num, args) end @@logger.info "Instrumenting Random methods: #{METHOD_NAMES}" instrumenter = Threatstack::Instrumentation::Instrumenter.instance METHOD_NAMES.each do |method_name| # Random lib instrumenter.wrap_class_method(Random, method_name, &on_method_call) instrumenter.wrap_instance_method(Random, method_name, &on_method_call) # Kernel lib instrumenter.wrap_class_method(Kernel, method_name, &on_method_call) instrumenter.wrap_instance_method(Kernel, method_name, &on_method_call) end end |