Class: Sentry::Redis Private
- Inherits:
-
Object
- Object
- Sentry::Redis
- Defined in:
- lib/sentry/redis.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: GlobalRedisInstrumentation, OldClientPatch
Constant Summary collapse
- OP_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"db.redis"
- SPAN_ORIGIN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"auto.db.redis"
- LOGGER_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
:redis_logger
Instance Method Summary collapse
-
#initialize(commands, host, port, db) ⇒ Redis
constructor
private
A new instance of Redis.
- #instrument ⇒ Object private
Constructor Details
#initialize(commands, host, port, db) ⇒ Redis
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.
Returns a new instance of Redis.
10 11 12 |
# File 'lib/sentry/redis.rb', line 10 def initialize(commands, host, port, db) @commands, @host, @port, @db = commands, host, port, db end |
Instance Method Details
#instrument ⇒ Object
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.
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 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 |