Module: BaselineRedRpm::Instruments::Redis
- Includes:
- Utils
- Defined in:
- lib/baseline_red_rpm/instruments/redis.rb
Instance Method Summary
collapse
Methods included from Utils
#connection_config, #format_redis, #format_redis_command, log_source_and_backtrace, #sanitize_sql
Instance Method Details
#call_pipeline_with_trace(*pipeline) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/baseline_red_rpm/instruments/redis.rb', line 34
def call_pipeline_with_trace(*pipeline)
if ::BaselineRedRpm::Tracer.tracing?
span = ::BaselineRedRpm.tracer.start_span("redis", tags: {
"component" => "Redis",
"span.kind" => "client",
"peer.address" => self.host,
"peer.port" => self.port,
"db.type" => "redis",
"db.vendor" => "redis",
"db.instance" => self.db,
"db.statement" => pipeline[0].commands.map { |c| format_redis_command(c) }.join("\n")
})
BaselineRedRpm::Utils.log_source_and_backtrace(span, :redis)
end
call_pipeline_without_trace(*pipeline)
rescue Exception => e
if span
span.set_tag('error', true)
span.log_error(e)
end
raise
ensure
span.finish if span
end
|
#call_with_trace(*command, &block) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/baseline_red_rpm/instruments/redis.rb', line 8
def call_with_trace(*command, &block)
if ::BaselineRedRpm::Tracer.tracing?
span = ::BaselineRedRpm.tracer.start_span("redis", tags: {
"component" => "Redis",
"span.kind" => "client",
"peer.address" => self.host,
"peer.port" => self.port,
"db.type" => "redis",
"db.vendor" => "redis",
"db.instance" => self.db,
"db.statement" => format_redis_command(*command)
})
BaselineRedRpm::Utils.log_source_and_backtrace(span, :redis)
end
call_without_trace(*command, &block)
rescue Exception => e
if span
span.set_tag('error', true)
span.log_error(e)
end
raise
ensure
span.finish if span
end
|