class Object
Public Instance Methods
_send_to_new_relic(args, elapsed)
click to toggle source
# File lib/newrelic_redis/instrumentation.rb, line 73 def _send_to_new_relic(args, elapsed) if NewRelic::Control.instance["transaction_tracer.record_sql"] == "obfuscated" args.map! do |arg| if arg.empty? arg else [arg.first] + ["?"] * (arg.count - 1) end end end NewRelic::Agent::Datastores.notice_statement(args.inspect, elapsed) end
call_pipelined_with_newrelic_trace(commands, *rest)
click to toggle source
# File lib/newrelic_redis/instrumentation.rb, line 47 def call_pipelined_with_newrelic_trace(commands, *rest) # Report each command as a metric suffixed with _pipelined, so the # user can at least see what all the commands were. additional = commands.map do |c| name = c.kind_of?(Array) ? c[0] : c "Datastore/operation/Redis/#{name.to_s.downcase}_pipelined" end callback = proc do |result, metric, elapsed| _send_to_new_relic(commands, elapsed) additional.each do |additional_metric| NewRelic::Agent::MethodTracer.trace_execution_scoped(additional_metric) do # No-op, just getting them as placeholders in the trace tree end end end NewRelic::Agent::Datastores.wrap("Redis", "pipelined", nil, callback) do call_pipelined_without_newrelic_trace commands, *rest end end
call_with_newrelic_trace(*args, &blk)
click to toggle source
# File lib/newrelic_redis/instrumentation.rb, line 29 def call_with_newrelic_trace(*args, &blk) method_name = args[0].is_a?(Array) ? args[0][0] : args[0] callback = proc do |result, metric, elapsed| _send_to_new_relic(args, elapsed) end NewRelic::Agent::Datastores.wrap("Redis", method_name, nil, callback) do call_without_newrelic_trace(*args, &blk) end end