Module: BrainzLab::Instrumentation::RedisInstrumentation::LegacyPatch

Defined in:
lib/brainzlab/instrumentation/redis.rb

Overview

Patch for Redis < 5

Instance Method Summary collapse

Instance Method Details

#call(command) ⇒ Object



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/brainzlab/instrumentation/redis.rb', line 203

def call(command)
  return super unless should_track?
  return super if should_skip_command?(command)

  started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)

  begin
    result = super
    record_command(command, started_at)
    result
  rescue StandardError => e
    error_info = e.class.name
    record_command(command, started_at, error_info)
    raise
  end
end

#call_pipeline(pipeline) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/brainzlab/instrumentation/redis.rb', line 220

def call_pipeline(pipeline)
  return super unless should_track?

  started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  commands = pipeline.commands

  begin
    result = super
    record_pipeline(commands, started_at)
    result
  rescue StandardError => e
    error_info = e.class.name
    record_pipeline(commands, started_at, error_info)
    raise
  end
end