Method: Sentry::Redis#instrument

Defined in:
lib/sentry/redis.rb

#instrumentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

[View source]

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sentry/redis.rb', line 14

def instrument
  return yield unless Sentry.initialized?

  Sentry.with_child_span(op: OP_NAME, start_timestamp: Sentry.utc_now.to_f, origin: SPAN_ORIGIN) do |span|
    yield.tap do
      record_breadcrumb

      if span
        span.set_description(commands_description)
        span.set_data(Span::DataConventions::DB_SYSTEM, "redis")
        span.set_data(Span::DataConventions::DB_NAME, db)
        span.set_data(Span::DataConventions::SERVER_ADDRESS, host)
        span.set_data(Span::DataConventions::SERVER_PORT, port)
      end
    end
  end
end