Module: Raygun::Apm::Hooks::Redis

Defined in:
lib/raygun/apm/hooks/redis.rb

Instance Method Summary collapse

Instance Method Details

#process(commands) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/raygun/apm/hooks/redis.rb', line 5

def process(commands)
  result = nil
  if tracer = Raygun::Apm::Tracer.instance
    started = tracer.now
    result = super
    ended = tracer.now
    event = raygun_apm_sql_event
    event[:pid] = Process.pid
    event[:query] = raygun_format_query(commands)
    event[:provider] = "redis"
    event[:host] = "#{host}:#{port}"
    event[:database] = db.to_s
    event[:duration] = ended - started
    event[:timestamp] = started
    event[:tid] = tracer.get_thread_id(Thread.current)
    tracer.emit(event)
    result
  else
    super
  end
end