Module: Datadog::Tracing::Contrib::Redis::TraceMiddleware
- Defined in:
- lib/datadog/tracing/contrib/redis/trace_middleware.rb
Overview
Instrumentation for Redis 5+
Class Method Summary collapse
- .call(client, command, service_name, command_args) ⇒ Object
- .call_pipelined(client, commands, service_name, command_args) ⇒ Object
Instance Method Summary collapse
-
#call(command, redis_config) ⇒ Object
Instruments RedisClient::ConnectionMixin#call.
-
#call_pipelined(commands, redis_config) ⇒ Object
Instruments RedisClient::ConnectionMixin#call_pipelined.
Class Method Details
.call(client, command, service_name, command_args) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/datadog/tracing/contrib/redis/trace_middleware.rb', line 27 def call(client, command, service_name, command_args) Tracing.trace(Redis::Ext::SPAN_COMMAND, type: Redis::Ext::TYPE, service: service_name) do |span| raw_command = get_command(command, true) span.resource = command_args ? raw_command : get_command(command, false) Contrib::Redis::Tags.(client, span, raw_command) yield end end |
.call_pipelined(client, commands, service_name, command_args) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/datadog/tracing/contrib/redis/trace_middleware.rb', line 38 def call_pipelined(client, commands, service_name, command_args) Tracing.trace(Redis::Ext::SPAN_COMMAND, type: Redis::Ext::TYPE, service: service_name) do |span| raw_command = get_pipeline_commands(commands, true) span.resource = command_args ? raw_command : get_pipeline_commands(commands, false) span.set_metric Contrib::Redis::Ext::METRIC_PIPELINE_LEN, commands.length Contrib::Redis::Tags.(client, span, raw_command) yield end end |
Instance Method Details
#call(command, redis_config) ⇒ Object
Instruments RedisClient::ConnectionMixin#call.
15 16 17 18 |
# File 'lib/datadog/tracing/contrib/redis/trace_middleware.rb', line 15 def call(command, redis_config) config = resolve(redis_config) TraceMiddleware.call(redis_config, command, config[:service_name], config[:command_args]) { super } end |
#call_pipelined(commands, redis_config) ⇒ Object
Instruments RedisClient::ConnectionMixin#call_pipelined.
21 22 23 24 |
# File 'lib/datadog/tracing/contrib/redis/trace_middleware.rb', line 21 def call_pipelined(commands, redis_config) config = resolve(redis_config) TraceMiddleware.call_pipelined(redis_config, commands, config[:service_name], config[:command_args]) { super } end |