instana 1.214.3 → 1.215.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -10
- data/.tekton/.currency/currency-pipeline.yaml +36 -0
- data/.tekton/.currency/currency-pipelinerun.yaml +20 -0
- data/.tekton/.currency/currency-rbac.yaml +29 -0
- data/.tekton/.currency/currency-scheduled-eventlistener.yaml +56 -0
- data/.tekton/.currency/currency-tasks.yaml +94 -0
- data/.tekton/.currency/docs/report.md +19 -0
- data/.tekton/.currency/resources/requirements.txt +5 -0
- data/.tekton/.currency/resources/table.json +94 -0
- data/.tekton/.currency/scripts/generate_report.py +228 -0
- data/.tekton/github-pr-eventlistener.yaml +2 -0
- data/.tekton/pipeline.yaml +61 -19
- data/.tekton/pipelinerun.yaml +2 -0
- data/.tekton/ruby-tracer-prepuller.yaml +83 -0
- data/.tekton/scheduled-eventlistener.yaml +2 -0
- data/.tekton/task.yaml +3 -26
- data/gemfiles/net_http_01.gemfile +1 -0
- data/lib/instana/activators/action_view.rb +5 -2
- data/lib/instana/config.rb +3 -0
- data/lib/instana/instrumentation/action_view.rb +40 -14
- data/lib/instana/instrumentation/excon.rb +4 -2
- data/lib/instana/instrumentation/net-http.rb +7 -1
- data/lib/instana/instrumentation/redis.rb +1 -1
- data/lib/instana/tracer.rb +7 -6
- data/lib/instana/version.rb +1 -1
- data/test/backend/host_agent_test.rb +16 -4
- data/test/instrumentation/dalli_test.rb +33 -0
- data/test/instrumentation/excon_test.rb +40 -0
- data/test/instrumentation/graphql_test.rb +41 -0
- data/test/instrumentation/grpc_test.rb +40 -1
- data/test/instrumentation/mongo_test.rb +31 -0
- data/test/instrumentation/net_http_test.rb +22 -2
- data/test/instrumentation/rails_action_mailer_test.rb +18 -0
- data/test/instrumentation/rails_action_view_test.rb +0 -41
- data/test/instrumentation/redis_test.rb +23 -0
- data/test/instrumentation/resque_test.rb +21 -0
- data/test/instrumentation/rest_client_test.rb +43 -0
- data/test/instrumentation/sidekiq-client_test.rb +37 -3
- data/test/instrumentation/sidekiq-worker_test.rb +2 -2
- data/test/secrets_test.rb +1 -1
- data/test/tracing/tracer_test.rb +2 -2
- metadata +12 -2
@@ -83,6 +83,10 @@ class GraphqlTest < Minitest::Test
|
|
83
83
|
mutation MutationType
|
84
84
|
end
|
85
85
|
|
86
|
+
def teardown
|
87
|
+
::Instana.config[:allow_exit_as_root] = false
|
88
|
+
end
|
89
|
+
|
86
90
|
def test_it_works
|
87
91
|
assert defined?(GraphQL)
|
88
92
|
end
|
@@ -127,6 +131,43 @@ class GraphqlTest < Minitest::Test
|
|
127
131
|
assert_equal expected_data, query_span[:data][:graphql]
|
128
132
|
end
|
129
133
|
|
134
|
+
def test_query_as_root_exit_span
|
135
|
+
clear_all!
|
136
|
+
|
137
|
+
query = "query FirstTwoTaskSamples {
|
138
|
+
tasks(after: \"\", first: 2) {
|
139
|
+
nodes {
|
140
|
+
action
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}"
|
144
|
+
|
145
|
+
expected_data = {
|
146
|
+
:operationName => "FirstTwoTaskSamples",
|
147
|
+
:operationType => "query",
|
148
|
+
:arguments => { "tasks" => ["after", "first"] },
|
149
|
+
:fields => { "tasks" => ["nodes"], "nodes" => ["action"] }
|
150
|
+
}
|
151
|
+
expected_results = {
|
152
|
+
"data" => {
|
153
|
+
"tasks" => {
|
154
|
+
"nodes" => [{"action" => "Sample 00"}, {"action" => "Sample 01"}]
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
::Instana.config[:allow_exit_as_root] = true
|
160
|
+
results = Schema.execute(query)
|
161
|
+
::Instana.config[:allow_exit_as_root] = false
|
162
|
+
queued_spans = Instana.processor.queued_spans
|
163
|
+
assert_equal 1, queued_spans.length
|
164
|
+
query_span = queued_spans[0]
|
165
|
+
|
166
|
+
assert_equal expected_results, results.to_h
|
167
|
+
assert_equal :'graphql.server', query_span[:n]
|
168
|
+
assert_equal expected_data, query_span[:data][:graphql]
|
169
|
+
end
|
170
|
+
|
130
171
|
def test_query_with_fragment
|
131
172
|
clear_all!
|
132
173
|
|
@@ -4,11 +4,15 @@
|
|
4
4
|
require 'test_helper'
|
5
5
|
require 'support/apps/grpc/boot'
|
6
6
|
|
7
|
-
class GrpcTest < Minitest::Test
|
7
|
+
class GrpcTest < Minitest::Test # rubocop:disable Metrics/ClassLength
|
8
8
|
def client_stub
|
9
9
|
PingPongService::Stub.new('127.0.0.1:50051', :this_channel_is_insecure)
|
10
10
|
end
|
11
11
|
|
12
|
+
def teardown
|
13
|
+
::Instana.config[:allow_exit_as_root] = false
|
14
|
+
end
|
15
|
+
|
12
16
|
def assert_client_span(client_span, call: '', call_type: '', error: nil)
|
13
17
|
data = client_span[:data]
|
14
18
|
assert_equal '127.0.0.1:50051', data[:rpc][:host]
|
@@ -80,6 +84,41 @@ class GrpcTest < Minitest::Test
|
|
80
84
|
assert_equal client_span[:p], sdk_span[:s]
|
81
85
|
end
|
82
86
|
|
87
|
+
def test_request_response_as_root_exit_span
|
88
|
+
clear_all!
|
89
|
+
::Instana.config[:allow_exit_as_root] = true
|
90
|
+
|
91
|
+
response = client_stub.ping(
|
92
|
+
PingPongService::PingRequest.new(message: 'Hello World')
|
93
|
+
)
|
94
|
+
sleep 1
|
95
|
+
|
96
|
+
assert 'Hello World', response.message
|
97
|
+
|
98
|
+
# Pause for a split second to allow traces to be queued
|
99
|
+
sleep 0.2
|
100
|
+
|
101
|
+
spans = ::Instana.processor.queued_spans
|
102
|
+
client_span = find_spans_by_name(spans, :'rpc-client').first
|
103
|
+
server_span = find_spans_by_name(spans, :'rpc-server').first
|
104
|
+
|
105
|
+
assert_client_span(
|
106
|
+
client_span,
|
107
|
+
call: '/PingPongService/Ping',
|
108
|
+
call_type: :request_response
|
109
|
+
)
|
110
|
+
|
111
|
+
assert_server_span(
|
112
|
+
server_span,
|
113
|
+
call: '/PingPongService/Ping',
|
114
|
+
call_type: :request_response
|
115
|
+
)
|
116
|
+
|
117
|
+
assert_equal client_span[:t], server_span[:t]
|
118
|
+
assert_equal client_span[:s], server_span[:p]
|
119
|
+
assert_nil client_span[:p]
|
120
|
+
end
|
121
|
+
|
83
122
|
def test_client_streamer
|
84
123
|
clear_all!
|
85
124
|
response = nil
|
@@ -8,6 +8,10 @@ class MongoTest < Minitest::Test
|
|
8
8
|
clear_all!
|
9
9
|
end
|
10
10
|
|
11
|
+
def teardown
|
12
|
+
::Instana.config[:allow_exit_as_root] = false
|
13
|
+
end
|
14
|
+
|
11
15
|
def test_mongo
|
12
16
|
Instana.tracer.start_or_continue_trace(:'mongo-test') do
|
13
17
|
client = Mongo::Client.new('mongodb://127.0.0.1:27017/instana')
|
@@ -34,4 +38,31 @@ class MongoTest < Minitest::Test
|
|
34
38
|
assert_equal insert_data[:peer], {hostname: "127.0.0.1", port: 27017}
|
35
39
|
assert insert_data[:json].include?("insert")
|
36
40
|
end
|
41
|
+
|
42
|
+
def test_mongo_as_root_exit_span
|
43
|
+
::Instana.config[:allow_exit_as_root] = true
|
44
|
+
|
45
|
+
client = Mongo::Client.new('mongodb://127.0.0.1:27017/instana')
|
46
|
+
client[:people].delete_many({ name: /$S*/ })
|
47
|
+
client[:people].insert_many([{ _id: 1, name: "Stan" }])
|
48
|
+
|
49
|
+
spans = ::Instana.processor.queued_spans
|
50
|
+
delete_span, insert_span, = spans
|
51
|
+
|
52
|
+
delete_data = delete_span[:data][:mongo]
|
53
|
+
insert_data = insert_span[:data][:mongo]
|
54
|
+
|
55
|
+
assert_equal delete_span[:n], :mongo
|
56
|
+
assert_equal insert_span[:n], :mongo
|
57
|
+
|
58
|
+
assert_equal delete_data[:namespace], "instana"
|
59
|
+
assert_equal delete_data[:command], "delete"
|
60
|
+
assert_equal delete_data[:peer], {hostname: "127.0.0.1", port: 27017}
|
61
|
+
assert delete_data[:json].include?("delete")
|
62
|
+
|
63
|
+
assert_equal insert_data[:namespace], "instana"
|
64
|
+
assert_equal insert_data[:command], "insert"
|
65
|
+
assert_equal insert_data[:peer], {hostname: "127.0.0.1", port: 27017}
|
66
|
+
assert insert_data[:json].include?("insert")
|
67
|
+
end
|
37
68
|
end
|
@@ -5,6 +5,10 @@ require 'test_helper'
|
|
5
5
|
require 'support/apps/http_endpoint/boot'
|
6
6
|
|
7
7
|
class NetHTTPTest < Minitest::Test
|
8
|
+
def teardown
|
9
|
+
::Instana.config[:allow_exit_as_root] = false
|
10
|
+
end
|
11
|
+
|
8
12
|
def test_config_defaults
|
9
13
|
assert ::Instana.config[:nethttp].is_a?(Hash)
|
10
14
|
assert ::Instana.config[:nethttp].key?(:enabled)
|
@@ -47,6 +51,22 @@ class NetHTTPTest < Minitest::Test
|
|
47
51
|
WebMock.disable_net_connect!
|
48
52
|
end
|
49
53
|
|
54
|
+
def test_get_without_query_as_root_exit_span
|
55
|
+
clear_all!
|
56
|
+
::Instana.config[:allow_exit_as_root] = true
|
57
|
+
WebMock.allow_net_connect!
|
58
|
+
Net::HTTP.get(URI('http://127.0.0.1:6511/'))
|
59
|
+
|
60
|
+
spans = ::Instana.processor.queued_spans
|
61
|
+
assert_equal 2, spans.length # 1 rack span from the endpoint is generated extra
|
62
|
+
|
63
|
+
http_span = find_first_span_by_name(spans, :'net-http')
|
64
|
+
assert_equal "http://127.0.0.1:6511/", http_span[:data][:http][:url]
|
65
|
+
assert_equal "200", http_span[:data][:http][:status]
|
66
|
+
|
67
|
+
WebMock.disable_net_connect!
|
68
|
+
end
|
69
|
+
|
50
70
|
def test_block_request
|
51
71
|
clear_all!
|
52
72
|
WebMock.allow_net_connect!
|
@@ -183,8 +203,8 @@ class NetHTTPTest < Minitest::Test
|
|
183
203
|
|
184
204
|
assert_equal :sdk, sdk_span[:n]
|
185
205
|
assert_equal :'net-http-error-test', sdk_span[:data][:sdk][:name]
|
186
|
-
|
187
|
-
|
206
|
+
assert_nil sdk_span[:error]
|
207
|
+
assert_nil sdk_span[:ec]
|
188
208
|
|
189
209
|
refute_nil http_span.key?(:data)
|
190
210
|
refute_nil http_span[:data].key?(:http)
|
@@ -34,6 +34,10 @@ class RailsActionMailerTest < Minitest::Test
|
|
34
34
|
clear_all!
|
35
35
|
end
|
36
36
|
|
37
|
+
def teardown
|
38
|
+
::Instana.config[:allow_exit_as_root] = false
|
39
|
+
end
|
40
|
+
|
37
41
|
def test_mailer
|
38
42
|
Instana.tracer.start_or_continue_trace(:test) do
|
39
43
|
TestMailer.sample_email.deliver_now
|
@@ -45,4 +49,18 @@ class RailsActionMailerTest < Minitest::Test
|
|
45
49
|
assert_equal 'RailsActionMailerTest::TestMailer', mail_span[:data][:actionmailer][:class]
|
46
50
|
assert_equal 'sample_email', mail_span[:data][:actionmailer][:method]
|
47
51
|
end
|
52
|
+
|
53
|
+
def test_mailer_as_root_exit_span
|
54
|
+
::Instana.config[:allow_exit_as_root] = true
|
55
|
+
TestMailer.sample_email.deliver_now
|
56
|
+
::Instana.config[:allow_exit_as_root] = false
|
57
|
+
|
58
|
+
queued_spans = Instana.processor.queued_spans
|
59
|
+
assert_equal 1, queued_spans.length
|
60
|
+
mail_span = queued_spans[0]
|
61
|
+
|
62
|
+
assert_equal :"mail.actionmailer", mail_span[:n]
|
63
|
+
assert_equal 'RailsActionMailerTest::TestMailer', mail_span[:data][:actionmailer][:class]
|
64
|
+
assert_equal 'sample_email', mail_span[:data][:actionmailer][:method]
|
65
|
+
end
|
48
66
|
end
|
@@ -17,18 +17,6 @@ class RailsActionViewTest < Minitest::Test
|
|
17
17
|
|
18
18
|
def setup
|
19
19
|
clear_all!
|
20
|
-
@framework_version = Gem::Specification.find_by_name('rails').version
|
21
|
-
@supported_framework_version = @framework_version < Gem::Version.new('6.1')
|
22
|
-
@execute_test_if_framework_version_is_supported = lambda {
|
23
|
-
unless @supported_framework_version
|
24
|
-
skip "Skipping this test because Rails version #{@framework_version} is not yet supported!"
|
25
|
-
end
|
26
|
-
}
|
27
|
-
@execute_test_only_if_framework_version_is_not_supported = lambda {
|
28
|
-
if @supported_framework_version
|
29
|
-
skip "Skipping this test because Rails version #{@framework_version} is already supported!"
|
30
|
-
end
|
31
|
-
}
|
32
20
|
end
|
33
21
|
|
34
22
|
def test_config_defaults
|
@@ -37,25 +25,7 @@ class RailsActionViewTest < Minitest::Test
|
|
37
25
|
assert_equal true, ::Instana.config[:action_view][:enabled]
|
38
26
|
end
|
39
27
|
|
40
|
-
def test_no_tracing_if_unsupported_version_only_render_is_ok
|
41
|
-
@execute_test_only_if_framework_version_is_not_supported.call
|
42
|
-
|
43
|
-
['/render_view', '/render_view_direct', '/render_partial', '/render_collection', '/render_file',
|
44
|
-
'/render_alternate_layout', '/render_json', '/render_xml',
|
45
|
-
'/render_rawbody', '/render_js'].each do |endpoint|
|
46
|
-
get endpoint
|
47
|
-
assert last_response.ok?
|
48
|
-
end
|
49
|
-
|
50
|
-
get '/render_partial_that_errors'
|
51
|
-
assert_equal false, last_response.ok?
|
52
|
-
|
53
|
-
spans = ::Instana.processor.queued_spans
|
54
|
-
assert_equal [], spans
|
55
|
-
end
|
56
|
-
|
57
28
|
def test_render_view
|
58
|
-
@execute_test_if_framework_version_is_supported.call
|
59
29
|
get '/render_view'
|
60
30
|
assert last_response.ok?
|
61
31
|
|
@@ -66,7 +36,6 @@ class RailsActionViewTest < Minitest::Test
|
|
66
36
|
end
|
67
37
|
|
68
38
|
def test_render_view_direct
|
69
|
-
@execute_test_if_framework_version_is_supported.call
|
70
39
|
get '/render_view_direct'
|
71
40
|
assert last_response.ok?
|
72
41
|
|
@@ -89,7 +58,6 @@ class RailsActionViewTest < Minitest::Test
|
|
89
58
|
end
|
90
59
|
|
91
60
|
def test_render_file
|
92
|
-
@execute_test_if_framework_version_is_supported.call
|
93
61
|
get '/render_file'
|
94
62
|
assert last_response.ok?
|
95
63
|
|
@@ -100,7 +68,6 @@ class RailsActionViewTest < Minitest::Test
|
|
100
68
|
end
|
101
69
|
|
102
70
|
def test_render_json
|
103
|
-
@execute_test_if_framework_version_is_supported.call
|
104
71
|
get '/render_json'
|
105
72
|
assert last_response.ok?
|
106
73
|
|
@@ -111,7 +78,6 @@ class RailsActionViewTest < Minitest::Test
|
|
111
78
|
end
|
112
79
|
|
113
80
|
def test_render_xml
|
114
|
-
@execute_test_if_framework_version_is_supported.call
|
115
81
|
get '/render_xml'
|
116
82
|
assert last_response.ok?
|
117
83
|
|
@@ -122,7 +88,6 @@ class RailsActionViewTest < Minitest::Test
|
|
122
88
|
end
|
123
89
|
|
124
90
|
def test_render_body
|
125
|
-
@execute_test_if_framework_version_is_supported.call
|
126
91
|
get '/render_rawbody'
|
127
92
|
assert last_response.ok?
|
128
93
|
|
@@ -133,7 +98,6 @@ class RailsActionViewTest < Minitest::Test
|
|
133
98
|
end
|
134
99
|
|
135
100
|
def test_render_js
|
136
|
-
@execute_test_if_framework_version_is_supported.call
|
137
101
|
get '/render_js'
|
138
102
|
assert last_response.ok?
|
139
103
|
|
@@ -144,7 +108,6 @@ class RailsActionViewTest < Minitest::Test
|
|
144
108
|
end
|
145
109
|
|
146
110
|
def test_render_alternate_layout
|
147
|
-
@execute_test_if_framework_version_is_supported.call
|
148
111
|
get '/render_alternate_layout'
|
149
112
|
assert last_response.ok?
|
150
113
|
|
@@ -155,7 +118,6 @@ class RailsActionViewTest < Minitest::Test
|
|
155
118
|
end
|
156
119
|
|
157
120
|
def test_render_partial
|
158
|
-
@execute_test_if_framework_version_is_supported.call
|
159
121
|
get '/render_partial'
|
160
122
|
assert last_response.ok?
|
161
123
|
|
@@ -166,7 +128,6 @@ class RailsActionViewTest < Minitest::Test
|
|
166
128
|
end
|
167
129
|
|
168
130
|
def test_render_partial_that_errors
|
169
|
-
@execute_test_if_framework_version_is_supported.call
|
170
131
|
get '/render_partial_that_errors'
|
171
132
|
refute last_response.ok?
|
172
133
|
|
@@ -182,13 +143,11 @@ class RailsActionViewTest < Minitest::Test
|
|
182
143
|
end
|
183
144
|
|
184
145
|
def test_render_collection
|
185
|
-
@execute_test_if_framework_version_is_supported.call
|
186
146
|
get '/render_collection'
|
187
147
|
assert last_response.ok?
|
188
148
|
|
189
149
|
spans = ::Instana.processor.queued_spans
|
190
150
|
span = find_first_span_by_name(spans, :render)
|
191
|
-
|
192
151
|
assert_equal :collection, span[:data][:render][:type]
|
193
152
|
assert_equal 'blocks/block', span[:data][:render][:name]
|
194
153
|
end
|
@@ -23,6 +23,29 @@ class RedisTest < Minitest::Test
|
|
23
23
|
assert_redis_trace('SET')
|
24
24
|
end
|
25
25
|
|
26
|
+
def test_normal_call_as_root_exit_span
|
27
|
+
clear_all!
|
28
|
+
|
29
|
+
::Instana.config[:allow_exit_as_root] = true
|
30
|
+
|
31
|
+
@redis_client.set('hello', 'world')
|
32
|
+
|
33
|
+
spans = ::Instana.processor.queued_spans
|
34
|
+
assert_equal 1, spans.length
|
35
|
+
redis_span = spans[0]
|
36
|
+
|
37
|
+
# first_span is the parent of second_span
|
38
|
+
assert_equal :redis, redis_span[:n]
|
39
|
+
|
40
|
+
data = redis_span[:data]
|
41
|
+
|
42
|
+
uri = URI.parse(@redis_url)
|
43
|
+
assert_equal "#{uri.host}:#{uri.port}", data[:redis][:connection]
|
44
|
+
|
45
|
+
assert_equal "0", data[:redis][:db]
|
46
|
+
assert_equal "SET", data[:redis][:command]
|
47
|
+
end
|
48
|
+
|
26
49
|
def test_georadius
|
27
50
|
clear_all!
|
28
51
|
|
@@ -15,6 +15,7 @@ class ResqueClientTest < Minitest::Test
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def teardown
|
18
|
+
::Instana.config[:allow_exit_as_root] = false
|
18
19
|
end
|
19
20
|
|
20
21
|
def test_enqueue
|
@@ -40,6 +41,26 @@ class ResqueClientTest < Minitest::Test
|
|
40
41
|
assert_equal resque_job.args.first['span_id'], resque_span[:s]
|
41
42
|
end
|
42
43
|
|
44
|
+
def test_enqueue_as_root_exit_span
|
45
|
+
::Instana.config[:allow_exit_as_root] = true
|
46
|
+
::Resque.enqueue(FastJob)
|
47
|
+
::Instana.config[:allow_exit_as_root] = false
|
48
|
+
|
49
|
+
resque_job = Resque.reserve('critical')
|
50
|
+
spans = ::Instana.processor.queued_spans
|
51
|
+
assert_equal 1, spans.length
|
52
|
+
|
53
|
+
resque_span = spans[0]
|
54
|
+
|
55
|
+
assert_equal :"resque-client", resque_span[:n]
|
56
|
+
assert_equal "FastJob", resque_span[:data][:'resque-client'][:job]
|
57
|
+
assert_equal :critical, resque_span[:data][:'resque-client'][:queue]
|
58
|
+
assert_equal false, resque_span[:data][:'resque-client'].key?(:error)
|
59
|
+
|
60
|
+
assert_equal resque_job.args.first['trace_id'], resque_span[:t]
|
61
|
+
assert_equal resque_job.args.first['span_id'], resque_span[:s]
|
62
|
+
end
|
63
|
+
|
43
64
|
def test_enqueue_to
|
44
65
|
::Instana.tracer.start_or_continue_trace(:'resque-client_test') do
|
45
66
|
::Resque.enqueue_to(:critical, FastJob)
|
@@ -10,6 +10,10 @@ class RestClientTest < Minitest::Test
|
|
10
10
|
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ciphers] = OpenSSL::SSL::SSLContext.new.ciphers
|
11
11
|
end
|
12
12
|
|
13
|
+
def teardown
|
14
|
+
::Instana.config[:allow_exit_as_root] = false
|
15
|
+
end
|
16
|
+
|
13
17
|
def test_config_defaults
|
14
18
|
assert ::Instana.config[:'rest-client'].is_a?(Hash)
|
15
19
|
assert ::Instana.config[:'rest-client'].key?(:enabled)
|
@@ -61,4 +65,43 @@ class RestClientTest < Minitest::Test
|
|
61
65
|
|
62
66
|
WebMock.disable_net_connect!
|
63
67
|
end
|
68
|
+
|
69
|
+
def test_basic_get_as_root_exit_span
|
70
|
+
clear_all!
|
71
|
+
::Instana.config[:allow_exit_as_root] = true
|
72
|
+
WebMock.allow_net_connect!
|
73
|
+
|
74
|
+
url = "http://127.0.0.1:6511/"
|
75
|
+
|
76
|
+
RestClient.get url
|
77
|
+
|
78
|
+
spans = ::Instana.processor.queued_spans
|
79
|
+
assert_equal 3, spans.length
|
80
|
+
|
81
|
+
rack_span = find_first_span_by_name(spans, :rack)
|
82
|
+
rest_span = find_first_span_by_name(spans, :'rest-client')
|
83
|
+
net_span = find_first_span_by_name(spans, :'net-http')
|
84
|
+
|
85
|
+
# Span name validation
|
86
|
+
assert_equal :rack, rack_span[:n]
|
87
|
+
assert_equal :sdk, rest_span[:n]
|
88
|
+
assert_equal :"net-http", net_span[:n]
|
89
|
+
|
90
|
+
# Trace IDs and relationships
|
91
|
+
trace_id = net_span[:t]
|
92
|
+
assert_equal trace_id, rest_span[:t]
|
93
|
+
assert_equal trace_id, rack_span[:t]
|
94
|
+
|
95
|
+
assert_nil rest_span[:p]
|
96
|
+
assert_equal rest_span[:s], net_span[:p]
|
97
|
+
assert_equal net_span[:s], rack_span[:p]
|
98
|
+
|
99
|
+
# data keys/values
|
100
|
+
refute_nil net_span.key?(:data)
|
101
|
+
refute_nil net_span[:data].key?(:http)
|
102
|
+
assert_equal "http://127.0.0.1:6511/", net_span[:data][:http][:url]
|
103
|
+
assert_equal "200", net_span[:data][:http][:status]
|
104
|
+
|
105
|
+
WebMock.disable_net_connect!
|
106
|
+
end
|
64
107
|
end
|
@@ -9,6 +9,10 @@ class SidekiqClientTest < Minitest::Test
|
|
9
9
|
::Sidekiq::Queue.new('some_random_queue').clear
|
10
10
|
end
|
11
11
|
|
12
|
+
def teardown
|
13
|
+
::Instana.config[:allow_exit_as_root] = false
|
14
|
+
end
|
15
|
+
|
12
16
|
def test_config_defaults
|
13
17
|
assert ::Instana.config[:'sidekiq-client'].is_a?(Hash)
|
14
18
|
assert ::Instana.config[:'sidekiq-client'].key?(:enabled)
|
@@ -35,6 +39,36 @@ class SidekiqClientTest < Minitest::Test
|
|
35
39
|
assert_normal_trace_recorded(job)
|
36
40
|
end
|
37
41
|
|
42
|
+
def test_enqueue_as_root_exit_span
|
43
|
+
clear_all!
|
44
|
+
::Instana.config[:allow_exit_as_root] = true
|
45
|
+
disable_redis_instrumentation
|
46
|
+
::Sidekiq::Client.push(
|
47
|
+
'queue' => 'some_random_queue',
|
48
|
+
'class' => ::SidekiqJobOne,
|
49
|
+
'args' => [1, 2, 3],
|
50
|
+
'retry' => false
|
51
|
+
)
|
52
|
+
::Instana.config[:allow_exit_as_root] = false
|
53
|
+
enable_redis_instrumentation
|
54
|
+
|
55
|
+
queue = ::Sidekiq::Queue.new('some_random_queue')
|
56
|
+
job = queue.first
|
57
|
+
|
58
|
+
assert_job_enqueued(job)
|
59
|
+
spans = ::Instana.processor.queued_spans
|
60
|
+
assert_equal 1, spans.length
|
61
|
+
|
62
|
+
first_span = spans[0]
|
63
|
+
|
64
|
+
assert_equal :'sidekiq-client', first_span[:n]
|
65
|
+
assert_equal 'some_random_queue', first_span[:data][:'sidekiq-client'][:queue]
|
66
|
+
assert_equal 'SidekiqJobOne', first_span[:data][:'sidekiq-client'][:job]
|
67
|
+
assert_equal "false", first_span[:data][:'sidekiq-client'][:retry]
|
68
|
+
assert first_span[:data][:'sidekiq-client'][:'redis-url']
|
69
|
+
assert_equal job['jid'], first_span[:data][:'sidekiq-client'][:job_id]
|
70
|
+
end
|
71
|
+
|
38
72
|
def test_enqueue_failure
|
39
73
|
clear_all!
|
40
74
|
|
@@ -68,8 +102,8 @@ class SidekiqClientTest < Minitest::Test
|
|
68
102
|
assert_equal 'SidekiqJobOne', job_message['class']
|
69
103
|
assert_equal [1, 2, 3], job_message['args']
|
70
104
|
assert_equal false, job_message['retry']
|
71
|
-
|
72
|
-
|
105
|
+
refute_nil job_message['X-Instana-T']
|
106
|
+
refute_nil job_message['X-Instana-S']
|
73
107
|
end
|
74
108
|
|
75
109
|
def assert_normal_trace_recorded(job)
|
@@ -102,7 +136,7 @@ class SidekiqClientTest < Minitest::Test
|
|
102
136
|
|
103
137
|
assert_equal :'sidekiq-client', second_span[:n]
|
104
138
|
assert_equal true, second_span[:error]
|
105
|
-
|
139
|
+
refute_nil second_span[:stack]
|
106
140
|
|
107
141
|
assert_equal 'some_random_queue', second_span[:data][:'sidekiq-client'][:queue]
|
108
142
|
assert_equal 'SidekiqJobTwo', second_span[:data][:'sidekiq-client'][:job]
|
@@ -156,7 +156,7 @@ class SidekiqServerTest < Minitest::Test
|
|
156
156
|
assert_equal 'important', worker_span[:data][:'sidekiq-worker'][:queue]
|
157
157
|
assert_equal 'SidekiqJobOne', worker_span[:data][:'sidekiq-worker'][:job]
|
158
158
|
assert worker_span[:data][:'sidekiq-worker'][:'redis-url']
|
159
|
-
|
159
|
+
refute_nil worker_span[:data][:'sidekiq-worker'][:job_id]
|
160
160
|
end
|
161
161
|
|
162
162
|
def assert_failed_worker_span(worker_span)
|
@@ -165,7 +165,7 @@ class SidekiqServerTest < Minitest::Test
|
|
165
165
|
assert_equal 'important', worker_span[:data][:'sidekiq-worker'][:queue]
|
166
166
|
assert_equal 'SidekiqJobTwo', worker_span[:data][:'sidekiq-worker'][:job]
|
167
167
|
assert worker_span[:data][:'sidekiq-worker'][:'redis-url']
|
168
|
-
|
168
|
+
refute_nil worker_span[:data][:'sidekiq-worker'][:job_id]
|
169
169
|
|
170
170
|
assert_equal true, worker_span[:data][:'sidekiq-worker'][:error]
|
171
171
|
assert_equal 'Fail to execute the job', worker_span[:data][:log][:message]
|
data/test/secrets_test.rb
CHANGED
data/test/tracing/tracer_test.rb
CHANGED
@@ -121,7 +121,7 @@ class TracerTest < Minitest::Test
|
|
121
121
|
sdk_span = find_first_span_by_name(spans, :sub_block)
|
122
122
|
|
123
123
|
assert_equal rack_span[:n], :rack
|
124
|
-
|
124
|
+
assert_nil rack_span[:p]
|
125
125
|
assert_equal rack_span[:t], rack_span[:s]
|
126
126
|
assert_equal rack_span[:data][:one], 1
|
127
127
|
|
@@ -151,7 +151,7 @@ class TracerTest < Minitest::Test
|
|
151
151
|
assert_equal root_span[:data][:sdk][:name], :root_span
|
152
152
|
assert_equal root_span[:data][:sdk][:type], :entry
|
153
153
|
assert_equal root_span[:k], 1
|
154
|
-
|
154
|
+
assert_nil root_span[:p]
|
155
155
|
assert_equal root_span[:t], root_span[:s]
|
156
156
|
assert_equal root_span[:data][:sdk][:custom][:tags][:one], 1
|
157
157
|
|
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.
|
4
|
+
version: 1.215.0
|
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: 2024-
|
11
|
+
date: 2024-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -142,6 +142,15 @@ files:
|
|
142
142
|
- ".gitignore"
|
143
143
|
- ".rubocop.yml"
|
144
144
|
- ".rubocop_todo.yml"
|
145
|
+
- ".tekton/.currency/currency-pipeline.yaml"
|
146
|
+
- ".tekton/.currency/currency-pipelinerun.yaml"
|
147
|
+
- ".tekton/.currency/currency-rbac.yaml"
|
148
|
+
- ".tekton/.currency/currency-scheduled-eventlistener.yaml"
|
149
|
+
- ".tekton/.currency/currency-tasks.yaml"
|
150
|
+
- ".tekton/.currency/docs/report.md"
|
151
|
+
- ".tekton/.currency/resources/requirements.txt"
|
152
|
+
- ".tekton/.currency/resources/table.json"
|
153
|
+
- ".tekton/.currency/scripts/generate_report.py"
|
145
154
|
- ".tekton/github-interceptor-secret.yaml"
|
146
155
|
- ".tekton/github-pr-eventlistener.yaml"
|
147
156
|
- ".tekton/github-pr-pipeline.yaml.part"
|
@@ -149,6 +158,7 @@ files:
|
|
149
158
|
- ".tekton/github-webhook-ingress.yaml"
|
150
159
|
- ".tekton/pipeline.yaml"
|
151
160
|
- ".tekton/pipelinerun.yaml"
|
161
|
+
- ".tekton/ruby-tracer-prepuller.yaml"
|
152
162
|
- ".tekton/run_unittests.sh"
|
153
163
|
- ".tekton/scheduled-eventlistener.yaml"
|
154
164
|
- ".tekton/task.yaml"
|