instana 1.11.5 → 1.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/instana/instrumentation/redis.rb +39 -33
- data/lib/instana/version.rb +1 -1
- data/test/instrumentation/resque_test.rb +9 -16
- data/test/jobs/resque_error_job.rb +2 -2
- data/test/jobs/resque_fast_job.rb +2 -2
- data/test/test_helper.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d171f2b3b043b7b18a534a9609b47098521a9de99755d347e3c338fb0d1adfa
|
4
|
+
data.tar.gz: 12d93179facc0038eb94b8233386cb7b8a0849d9cdf0f9a9f2ef66cbb9ed029d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05a5f54ed77c162a58ed331632398abe0777821ad0360978d88caf39cb8748dc91203696ac25120b048c0771e336bcb841e01e1539aa45de761efe8c99ec1847
|
7
|
+
data.tar.gz: 2b966772f1435202a9077a451e85ddcc3a598b2835cfdd1fd7b395685863b5d0bf11920ad1302f845663a6efce62e87b13574b8a3fa3f8673de0122414ef3790
|
@@ -2,28 +2,31 @@ if defined?(::Redis) && ::Instana.config[:redis][:enabled]
|
|
2
2
|
::Redis::Client.class_eval do
|
3
3
|
def call_with_instana(*args, &block)
|
4
4
|
kv_payload = { redis: {} }
|
5
|
+
dnt_spans = [:redis, :'resque-client', :'sidekiq-client']
|
5
6
|
|
6
|
-
if !Instana.tracer.tracing? || ::Instana.tracer.
|
7
|
+
if !Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name)
|
7
8
|
return call_without_instana(*args, &block)
|
8
9
|
end
|
9
10
|
|
10
|
-
::Instana.tracer.log_entry(:redis)
|
11
|
-
|
12
11
|
begin
|
13
|
-
|
14
|
-
kv_payload[:redis][:db] = db.to_s
|
15
|
-
kv_payload[:redis][:command] = args[0][0].to_s.upcase
|
16
|
-
rescue
|
17
|
-
nil
|
18
|
-
end
|
12
|
+
::Instana.tracer.log_entry(:redis)
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
begin
|
15
|
+
kv_payload[:redis][:connection] = "#{self.host}:#{self.port}"
|
16
|
+
kv_payload[:redis][:db] = db.to_s
|
17
|
+
kv_payload[:redis][:command] = args[0][0].to_s.upcase
|
18
|
+
rescue
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
|
22
|
+
call_without_instana(*args, &block)
|
23
|
+
rescue => e
|
24
|
+
::Instana.tracer.log_info({ redis: {error: true} })
|
25
|
+
::Instana.tracer.log_error(e)
|
26
|
+
raise
|
27
|
+
ensure
|
28
|
+
::Instana.tracer.log_exit(:redis, kv_payload)
|
29
|
+
end
|
27
30
|
end
|
28
31
|
|
29
32
|
::Instana.logger.debug "Instrumenting Redis"
|
@@ -33,29 +36,32 @@ if defined?(::Redis) && ::Instana.config[:redis][:enabled]
|
|
33
36
|
|
34
37
|
def call_pipeline_with_instana(*args, &block)
|
35
38
|
kv_payload = { redis: {} }
|
39
|
+
dnt_spans = [:redis, :'resque-client', :'sidekiq-client']
|
36
40
|
|
37
|
-
if !Instana.tracer.tracing? || ::Instana.tracer.
|
41
|
+
if !Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name)
|
38
42
|
return call_pipeline_without_instana(*args, &block)
|
39
43
|
end
|
40
44
|
|
41
|
-
::Instana.tracer.log_entry(:redis)
|
42
|
-
|
43
|
-
pipeline = args.first
|
44
45
|
begin
|
45
|
-
|
46
|
-
kv_payload[:redis][:db] = db.to_s
|
47
|
-
kv_payload[:redis][:command] = pipeline.is_a?(::Redis::Pipeline::Multi) ? 'MULTI' : 'PIPELINE'
|
48
|
-
rescue
|
49
|
-
nil
|
50
|
-
end
|
46
|
+
::Instana.tracer.log_entry(:redis)
|
51
47
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
48
|
+
pipeline = args.first
|
49
|
+
begin
|
50
|
+
kv_payload[:redis][:connection] = "#{self.host}:#{self.port}"
|
51
|
+
kv_payload[:redis][:db] = db.to_s
|
52
|
+
kv_payload[:redis][:command] = pipeline.is_a?(::Redis::Pipeline::Multi) ? 'MULTI' : 'PIPELINE'
|
53
|
+
rescue
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
|
57
|
+
call_pipeline_without_instana(*args, &block)
|
58
|
+
rescue => e
|
59
|
+
::Instana.tracer.log_info({ redis: {error: true} })
|
60
|
+
::Instana.tracer.log_error(e)
|
61
|
+
raise
|
62
|
+
ensure
|
63
|
+
::Instana.tracer.log_exit(:redis, kv_payload)
|
64
|
+
end
|
59
65
|
end
|
60
66
|
|
61
67
|
alias call_pipeline_without_instana call_pipeline
|
data/lib/instana/version.rb
CHANGED
@@ -5,8 +5,8 @@ require 'resque'
|
|
5
5
|
|
6
6
|
if ENV.key?('REDIS_URL')
|
7
7
|
::Resque.redis = ENV['REDIS_URL']
|
8
|
-
elsif ENV.key?('
|
9
|
-
::Resque.redis = ENV['
|
8
|
+
elsif ENV.key?('REDIS_URL')
|
9
|
+
::Resque.redis = ENV['REDIS_URL']
|
10
10
|
else
|
11
11
|
::Resque.redis = 'localhost:6379'
|
12
12
|
end
|
@@ -23,16 +23,15 @@ class ResqueClientTest < Minitest::Test
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_enqueue
|
26
|
-
::Instana.tracer.start_or_continue_trace('resque-client_test') do
|
26
|
+
::Instana.tracer.start_or_continue_trace(:'resque-client_test') do
|
27
27
|
::Resque.enqueue(FastJob)
|
28
28
|
end
|
29
29
|
|
30
30
|
spans = ::Instana.processor.queued_spans
|
31
|
-
assert_equal
|
31
|
+
assert_equal 2, spans.length
|
32
32
|
|
33
33
|
sdk_span = find_first_span_by_name(spans, :'resque-client_test')
|
34
34
|
resque_span = find_first_span_by_name(spans, :'resque-client')
|
35
|
-
redis_span = find_first_span_by_name(spans, :redis)
|
36
35
|
|
37
36
|
assert_equal :'resque-client_test', sdk_span[:data][:sdk][:name]
|
38
37
|
|
@@ -40,48 +39,42 @@ class ResqueClientTest < Minitest::Test
|
|
40
39
|
assert_equal "FastJob", resque_span[:data][:'resque-client'][:job]
|
41
40
|
assert_equal :critical, resque_span[:data][:'resque-client'][:queue]
|
42
41
|
assert_equal false, resque_span[:data][:'resque-client'].key?(:error)
|
43
|
-
|
44
|
-
assert_equal :redis, redis_span[:n]
|
45
42
|
end
|
46
43
|
|
47
44
|
def test_enqueue_to
|
48
|
-
::Instana.tracer.start_or_continue_trace('resque-client_test') do
|
45
|
+
::Instana.tracer.start_or_continue_trace(:'resque-client_test') do
|
49
46
|
::Resque.enqueue_to(:critical, FastJob)
|
50
47
|
end
|
51
48
|
|
52
49
|
spans = ::Instana.processor.queued_spans
|
53
|
-
assert_equal
|
50
|
+
assert_equal 2, spans.length
|
54
51
|
|
55
52
|
sdk_span = find_first_span_by_name(spans, :'resque-client_test')
|
56
53
|
resque_span = find_first_span_by_name(spans, :'resque-client')
|
57
|
-
redis_span = find_first_span_by_name(spans, :redis)
|
58
54
|
|
59
55
|
assert_equal :'resque-client_test', sdk_span[:data][:sdk][:name]
|
60
56
|
assert_equal :"resque-client", resque_span[:n]
|
61
57
|
assert_equal "FastJob", resque_span[:data][:'resque-client'][:job]
|
62
58
|
assert_equal :critical, resque_span[:data][:'resque-client'][:queue]
|
63
59
|
assert_equal false, resque_span[:data][:'resque-client'].key?(:error)
|
64
|
-
assert_equal :redis, redis_span[:n]
|
65
60
|
end
|
66
61
|
|
67
62
|
def test_dequeue
|
68
|
-
::Instana.tracer.start_or_continue_trace('resque-client_test', '', {}) do
|
63
|
+
::Instana.tracer.start_or_continue_trace(:'resque-client_test', '', {}) do
|
69
64
|
::Resque.dequeue(FastJob, { :generate => :farfalla })
|
70
65
|
end
|
71
66
|
|
72
67
|
spans = ::Instana.processor.queued_spans
|
73
|
-
assert_equal
|
68
|
+
assert_equal 2, spans.length
|
74
69
|
|
75
70
|
sdk_span = find_first_span_by_name(spans, :'resque-client_test')
|
76
71
|
resque_span = find_first_span_by_name(spans, :'resque-client')
|
77
|
-
redis_span = find_first_span_by_name(spans, :redis)
|
78
72
|
|
79
73
|
assert_equal :'resque-client_test', sdk_span[:data][:sdk][:name]
|
80
|
-
assert_equal :"resque-client",
|
74
|
+
assert_equal :"resque-client", resque_span[:n]
|
81
75
|
assert_equal "FastJob", resque_span[:data][:'resque-client'][:job]
|
82
76
|
assert_equal :critical, resque_span[:data][:'resque-client'][:queue]
|
83
77
|
assert_equal false, resque_span[:data][:'resque-client'].key?(:error)
|
84
|
-
assert_equal :redis, redis_span[:n]
|
85
78
|
end
|
86
79
|
|
87
80
|
def test_worker_job
|
@@ -7,8 +7,8 @@ class ErrorJob
|
|
7
7
|
def self.perform
|
8
8
|
if ENV.key?('REDIS_URL')
|
9
9
|
redis = Redis.new(:url => ENV['REDIS_URL'])
|
10
|
-
elsif ENV.key?('
|
11
|
-
redis = Redis.new(:url => ENV['
|
10
|
+
elsif ENV.key?('REDIS_URL')
|
11
|
+
redis = Redis.new(:url => ENV['REDIS_URL'])
|
12
12
|
else
|
13
13
|
redis = Redis.new(:url => 'localhost:6379')
|
14
14
|
end
|
@@ -7,8 +7,8 @@ class FastJob
|
|
7
7
|
def self.perform
|
8
8
|
if ENV.key?('REDIS_URL')
|
9
9
|
redis = Redis.new(:url => ENV['REDIS_URL'])
|
10
|
-
elsif ENV.key?('
|
11
|
-
redis = Redis.new(:url => ENV['
|
10
|
+
elsif ENV.key?('REDIS_URL')
|
11
|
+
redis = Redis.new(:url => ENV['REDIS_URL'])
|
12
12
|
else
|
13
13
|
redis = Redis.new(:url => 'redis://localhost:6379')
|
14
14
|
end
|
data/test/test_helper.rb
CHANGED
@@ -39,17 +39,17 @@ when /libraries/
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
ENV['
|
42
|
+
ENV['REDIS_URL'] ||= 'redis://127.0.0.1:6379'
|
43
43
|
|
44
44
|
# Configure redis for sidekiq client
|
45
45
|
Sidekiq.configure_client do |config|
|
46
|
-
config.redis = { url: ENV['
|
46
|
+
config.redis = { url: ENV['REDIS_URL'] }
|
47
47
|
end
|
48
48
|
|
49
49
|
# Configure redis for sidekiq worker
|
50
50
|
$sidekiq_mode = :server
|
51
51
|
::Sidekiq.configure_server do |config|
|
52
|
-
config.redis = { url: ENV['
|
52
|
+
config.redis = { url: ENV['REDIS_URL'] }
|
53
53
|
end
|
54
54
|
$sidekiq_mode = :client
|
55
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Giacomo Lombardo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -322,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
322
|
- !ruby/object:Gem::Version
|
323
323
|
version: '0'
|
324
324
|
requirements: []
|
325
|
-
rubygems_version: 3.0.
|
325
|
+
rubygems_version: 3.0.3
|
326
326
|
signing_key:
|
327
327
|
specification_version: 4
|
328
328
|
summary: Ruby Distributed Tracing & Metrics Sensor for Instana
|