Class: ApmTraceable::Adapters::StdoutAdapter

Inherits:
BaseAdapter
  • Object
show all
Defined in:
lib/apm_traceable/adapters/stdout_adapter.rb

Overview

標準出力へトレース結果を送るためのアダプター

Instance Method Summary collapse

Instance Method Details

#trace(trace_name, context_class:, **_options, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/apm_traceable/adapters/stdout_adapter.rb', line 9

def trace(trace_name, context_class:, **_options, &block)
  result = nil
  traced_sec = Benchmark.realtime do
    result = block.call
  end
  puts "#{context_class&.name}##{trace_name} #{format('%05.6f', traced_sec)}s"
  result
end