Module: AppMap::Hook::RecordAround

Included in:
Method
Defined in:
lib/appmap/hook/record_around.rb

Overview

Start and stop a recording around a Hook::Method.

Defined Under Namespace

Classes: Context

Constant Summary collapse

APPMAP_OUTPUT_DIR =
File.join(AppMap.output_dir, "requests")

Instance Method Summary collapse

Instance Method Details

#record_around?Boolean

If requests recording is enabled, and we encounter a method which should always be recorded when requests recording is on, and there is no other recording in progress, then start a new recording and end it when the method returns.

Returns:

  • (Boolean)


58
59
60
# File 'lib/appmap/hook/record_around.rb', line 58

def record_around?
  (record_around && AppMap.recording_enabled?(:requests) && !AppMap.tracing_enabled?(thread: Thread.current))
end

#record_around_afterObject



68
69
70
71
72
73
74
# File 'lib/appmap/hook/record_around.rb', line 68

def record_around_after
  return unless @record_around_context

  context = @record_around_context
  @record_around_context = nil
  context.finish
end

#record_around_beforeObject



62
63
64
65
66
# File 'lib/appmap/hook/record_around.rb', line 62

def record_around_before
  return unless record_around?

  @record_around_context = Context.new(hook_method)
end