instana 1.13.0 → 1.193.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +200 -133
  3. data/.editorconfig +10 -0
  4. data/.gitignore +3 -0
  5. data/.rubocop.yml +5 -1147
  6. data/.rubocop_todo.yml +1140 -0
  7. data/Appraisals +100 -0
  8. data/Gemfile +11 -32
  9. data/Rakefile +16 -39
  10. data/bin/console +5 -4
  11. data/gemfiles/.bundle/config +1 -2
  12. data/gemfiles/cuba_30.gemfile +15 -0
  13. data/gemfiles/dalli_20.gemfile +15 -0
  14. data/gemfiles/excon_02.gemfile +15 -0
  15. data/gemfiles/graphql_10.gemfile +15 -0
  16. data/gemfiles/grpc_10.gemfile +15 -0
  17. data/gemfiles/net_http_01.gemfile +14 -0
  18. data/gemfiles/rack_16.gemfile +15 -0
  19. data/gemfiles/rack_20.gemfile +15 -0
  20. data/gemfiles/rails_42.gemfile +18 -0
  21. data/gemfiles/rails_50.gemfile +18 -0
  22. data/gemfiles/rails_52.gemfile +18 -0
  23. data/gemfiles/rails_60.gemfile +18 -0
  24. data/gemfiles/redis_40.gemfile +15 -0
  25. data/gemfiles/resque_122.gemfile +16 -0
  26. data/gemfiles/resque_20.gemfile +15 -0
  27. data/gemfiles/rest_client_16.gemfile +15 -0
  28. data/gemfiles/rest_client_20.gemfile +15 -0
  29. data/gemfiles/roda_20.gemfile +15 -0
  30. data/gemfiles/roda_30.gemfile +15 -0
  31. data/gemfiles/sidekiq_42.gemfile +15 -0
  32. data/gemfiles/sidekiq_50.gemfile +15 -0
  33. data/gemfiles/sinatra_14.gemfile +15 -0
  34. data/instana.gemspec +1 -7
  35. data/lib/instana/activator.rb +41 -0
  36. data/lib/instana/activators/action_controller_api.rb +18 -0
  37. data/lib/instana/activators/action_controller_base.rb +18 -0
  38. data/lib/instana/activators/action_view.rb +18 -0
  39. data/lib/instana/activators/active_record.rb +18 -0
  40. data/lib/instana/activators/cuba.rb +18 -0
  41. data/lib/instana/activators/dalli.rb +20 -0
  42. data/lib/instana/activators/excon.rb +17 -0
  43. data/lib/instana/activators/graphql.rb +19 -0
  44. data/lib/instana/activators/grpc_client.rb +17 -0
  45. data/lib/instana/activators/grpc_server.rb +17 -0
  46. data/lib/instana/activators/net_http.rb +17 -0
  47. data/lib/instana/activators/rack.rb +13 -0
  48. data/lib/instana/activators/rails.rb +15 -0
  49. data/lib/instana/activators/redis.rb +17 -0
  50. data/lib/instana/activators/resque_client.rb +18 -0
  51. data/lib/instana/activators/resque_worker.rb +30 -0
  52. data/lib/instana/activators/rest_client.rb +17 -0
  53. data/lib/instana/activators/roda.rb +18 -0
  54. data/lib/instana/activators/sidekiq_client.rb +21 -0
  55. data/lib/instana/activators/sidekiq_worker.rb +21 -0
  56. data/lib/instana/activators/sinatra.rb +18 -0
  57. data/lib/instana/config.rb +11 -0
  58. data/lib/instana/frameworks/cuba.rb +6 -13
  59. data/lib/instana/frameworks/rails.rb +20 -33
  60. data/lib/instana/frameworks/roda.rb +7 -13
  61. data/lib/instana/frameworks/sinatra.rb +1 -8
  62. data/lib/instana/instrumentation/action_controller.rb +81 -0
  63. data/lib/instana/instrumentation/action_view.rb +27 -0
  64. data/lib/instana/instrumentation/active_record.rb +47 -0
  65. data/lib/instana/instrumentation/dalli.rb +7 -18
  66. data/lib/instana/instrumentation/excon.rb +51 -57
  67. data/lib/instana/instrumentation/graphql.rb +75 -0
  68. data/lib/instana/instrumentation/grpc.rb +70 -66
  69. data/lib/instana/instrumentation/instrumented_request.rb +69 -0
  70. data/lib/instana/instrumentation/net-http.rb +43 -47
  71. data/lib/instana/instrumentation/rack.rb +14 -53
  72. data/lib/instana/instrumentation/redis.rb +10 -18
  73. data/lib/instana/instrumentation/resque.rb +14 -50
  74. data/lib/instana/instrumentation/rest-client.rb +2 -17
  75. data/lib/instana/instrumentation/sidekiq-client.rb +0 -9
  76. data/lib/instana/instrumentation/sidekiq-worker.rb +0 -9
  77. data/lib/instana/secrets.rb +7 -7
  78. data/lib/instana/setup.rb +3 -1
  79. data/lib/instana/tracer.rb +6 -0
  80. data/lib/instana/tracing/span.rb +14 -10
  81. data/lib/instana/util.rb +15 -69
  82. data/lib/instana/version.rb +1 -1
  83. data/test/activator_test.rb +27 -0
  84. data/test/frameworks/cuba_test.rb +38 -40
  85. data/test/frameworks/roda_test.rb +39 -41
  86. data/test/frameworks/sinatra_test.rb +61 -64
  87. data/test/instrumentation/excon_test.rb +1 -2
  88. data/test/instrumentation/graphql_test.rb +116 -0
  89. data/test/instrumentation/grpc_test.rb +2 -1
  90. data/test/instrumentation/{net-http_test.rb → net_http_test.rb} +1 -0
  91. data/test/instrumentation/rack_instrumented_request_test.rb +84 -0
  92. data/test/{frameworks → instrumentation}/rack_test.rb +32 -20
  93. data/test/{frameworks/rails/actioncontroller_test.rb → instrumentation/rails_action_controller_test.rb} +37 -21
  94. data/test/instrumentation/rails_action_view_test.rb +138 -0
  95. data/test/instrumentation/rails_active_record_test.rb +121 -0
  96. data/test/instrumentation/redis_test.rb +10 -0
  97. data/test/instrumentation/resque_test.rb +3 -11
  98. data/test/instrumentation/{rest-client_test.rb → rest_client_test.rb} +6 -0
  99. data/test/instrumentation/sidekiq-client_test.rb +1 -0
  100. data/test/instrumentation/sidekiq-worker_test.rb +1 -0
  101. data/test/support/apps/active_record/active_record.rb +21 -0
  102. data/test/{servers/grpc_50051.rb → support/apps/grpc/boot.rb} +1 -1
  103. data/test/{apps → support/apps/grpc}/grpc_server.rb +0 -0
  104. data/test/{servers/rackapp_6511.rb → support/apps/http_endpoint/boot.rb} +0 -0
  105. data/test/{servers/rails_3205.rb → support/apps/rails/boot.rb} +8 -14
  106. data/test/{models → support/apps/rails/models}/block.rb +1 -1
  107. data/test/{models → support/apps/rails/models}/block6.rb +0 -0
  108. data/test/support/apps/resque/boot.rb +2 -0
  109. data/test/{jobs → support/apps/resque/jobs}/resque_error_job.rb +0 -0
  110. data/test/{jobs → support/apps/resque/jobs}/resque_fast_job.rb +0 -0
  111. data/test/support/apps/sidekiq/boot.rb +21 -0
  112. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_1.rb +0 -0
  113. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_2.rb +0 -0
  114. data/test/{servers → support/apps}/sidekiq/worker.rb +2 -2
  115. data/test/support/helpers.rb +94 -0
  116. data/test/test_helper.rb +24 -144
  117. data/test/tracing/id_management_test.rb +4 -66
  118. metadata +106 -95
  119. data/gemfiles/libraries.gemfile +0 -71
  120. data/gemfiles/rails32.gemfile +0 -51
  121. data/gemfiles/rails42.gemfile +0 -50
  122. data/gemfiles/rails50.gemfile +0 -52
  123. data/gemfiles/rails52.gemfile +0 -52
  124. data/gemfiles/rails60.gemfile +0 -72
  125. data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +0 -58
  126. data/lib/instana/frameworks/instrumentation/action_controller.rb +0 -194
  127. data/lib/instana/frameworks/instrumentation/action_view.rb +0 -43
  128. data/lib/instana/frameworks/instrumentation/active_record.rb +0 -27
  129. data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +0 -81
  130. data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +0 -56
  131. data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +0 -85
  132. data/lib/instana/instrumentation.rb +0 -25
  133. data/lib/instana/test.rb +0 -43
  134. data/test/apps/cuba.rb +0 -19
  135. data/test/apps/roda.rb +0 -13
  136. data/test/apps/sinatra.rb +0 -9
  137. data/test/frameworks/rails/actionview3_test.rb +0 -210
  138. data/test/frameworks/rails/actionview4_test.rb +0 -208
  139. data/test/frameworks/rails/actionview5_test.rb +0 -221
  140. data/test/frameworks/rails/activerecord_test.rb +0 -227
  141. data/test/servers/helpers/sidekiq_worker_initializer.rb +0 -27
@@ -1,66 +1,63 @@
1
- require 'sinatra'
2
- if defined?(::Sinatra)
3
- require 'test_helper'
4
- require File.expand_path(File.dirname(__FILE__) + '/../apps/sinatra')
5
- require 'rack/test'
6
-
7
- class SinatraTest < Minitest::Test
8
- include Rack::Test::Methods
9
-
10
- def app
11
- InstanaSinatraApp
12
- end
13
-
14
- def test_basic_get
15
- clear_all!
16
-
17
- r = get '/'
18
- assert last_response.ok?
19
-
20
-
21
- spans = ::Instana.processor.queued_spans
22
- assert_equal 1, spans.count
23
-
24
- rack_span = spans.first
25
- assert_equal :rack, rack_span[:n]
26
- # ::Instana::Util.pry!
27
-
28
- assert r.headers.key?("X-Instana-T")
29
- assert r.headers["X-Instana-T"] == ::Instana::Util.id_to_header(rack_span[:t])
30
- assert r.headers.key?("X-Instana-S")
31
- assert r.headers["X-Instana-S"] == ::Instana::Util.id_to_header(rack_span[:s])
32
- assert r.headers.key?("X-Instana-L")
33
- assert r.headers["X-Instana-L"] == '1'
34
- assert r.headers.key?("Server-Timing")
35
- assert r.headers["Server-Timing"] == "intid;desc=#{::Instana::Util.id_to_header(rack_span[:t])}"
36
-
37
- assert rack_span.key?(:data)
38
- assert rack_span[:data].key?(:http)
39
- assert rack_span[:data][:http].key?(:method)
40
- assert_equal "GET", rack_span[:data][:http][:method]
41
-
42
- assert rack_span[:data][:http].key?(:url)
43
- assert_equal "/", rack_span[:data][:http][:url]
44
-
45
- assert rack_span[:data][:http].key?(:status)
46
- assert_equal 200, rack_span[:data][:http][:status]
47
-
48
- assert rack_span[:data][:http].key?(:host)
49
- assert_equal "example.org", rack_span[:data][:http][:host]
50
- end
51
-
52
- def test_path_template
53
- clear_all!
54
-
55
- r = get '/greet/instana'
56
- assert last_response.ok?
57
-
58
- spans = ::Instana.processor.queued_spans
59
- assert_equal 1, spans.count
60
-
61
- first_span = spans.first
62
- assert_equal :rack, first_span[:n]
63
- assert_equal '/greet/:name', first_span[:data][:http][:path_tpl]
64
- end
1
+ require 'test_helper'
2
+ require 'rack/test'
3
+
4
+ class SinatraTest < Minitest::Test
5
+ include Rack::Test::Methods
6
+ APP = Rack::Builder.parse_file('test/support/apps/sinatra/config.ru').first
7
+
8
+ def app
9
+ APP
10
+ end
11
+
12
+ def test_basic_get
13
+ clear_all!
14
+
15
+ r = get '/'
16
+ assert last_response.ok?
17
+
18
+
19
+ spans = ::Instana.processor.queued_spans
20
+ assert_equal 1, spans.count
21
+
22
+ rack_span = spans.first
23
+ assert_equal :rack, rack_span[:n]
24
+ # ::Instana::Util.pry!
25
+
26
+ assert r.headers.key?("X-Instana-T")
27
+ assert r.headers["X-Instana-T"] == ::Instana::Util.id_to_header(rack_span[:t])
28
+ assert r.headers.key?("X-Instana-S")
29
+ assert r.headers["X-Instana-S"] == ::Instana::Util.id_to_header(rack_span[:s])
30
+ assert r.headers.key?("X-Instana-L")
31
+ assert r.headers["X-Instana-L"] == '1'
32
+ assert r.headers.key?("Server-Timing")
33
+ assert r.headers["Server-Timing"] == "intid;desc=#{::Instana::Util.id_to_header(rack_span[:t])}"
34
+
35
+ assert rack_span.key?(:data)
36
+ assert rack_span[:data].key?(:http)
37
+ assert rack_span[:data][:http].key?(:method)
38
+ assert_equal "GET", rack_span[:data][:http][:method]
39
+
40
+ assert rack_span[:data][:http].key?(:url)
41
+ assert_equal "/", rack_span[:data][:http][:url]
42
+
43
+ assert rack_span[:data][:http].key?(:status)
44
+ assert_equal 200, rack_span[:data][:http][:status]
45
+
46
+ assert rack_span[:data][:http].key?(:host)
47
+ assert_equal "example.org", rack_span[:data][:http][:host]
48
+ end
49
+
50
+ def test_path_template
51
+ clear_all!
52
+
53
+ r = get '/greet/instana'
54
+ assert last_response.ok?
55
+
56
+ spans = ::Instana.processor.queued_spans
57
+ assert_equal 1, spans.count
58
+
59
+ first_span = spans.first
60
+ assert_equal :rack, first_span[:n]
61
+ assert_equal '/greet/:name', first_span[:data][:http][:path_tpl]
65
62
  end
66
63
  end
@@ -1,4 +1,5 @@
1
1
  require 'test_helper'
2
+ require 'support/apps/http_endpoint/boot'
2
3
 
3
4
  class ExconTest < Minitest::Test
4
5
  def test_config_defaults
@@ -116,8 +117,6 @@ class ExconTest < Minitest::Test
116
117
  assert_equal 3, rack_spans.length
117
118
  assert_equal 3, excon_spans.length
118
119
 
119
- # ::Instana::Util.pry!
120
-
121
120
  for rack_span in rack_spans
122
121
  # data keys/values
123
122
  refute_nil rack_span.key?(:data)
@@ -0,0 +1,116 @@
1
+ require 'test_helper'
2
+
3
+ class GraphqlTest < Minitest::Test
4
+ class TaskType < GraphQL::Schema::Object
5
+ field :id, ID, null: false
6
+ field :action, String, null: false
7
+ end
8
+
9
+ class NewTaskType < GraphQL::Schema::Mutation
10
+ argument :action, String, required: true
11
+ field :task, TaskType, null: true
12
+
13
+ def resolve(action:)
14
+ {
15
+ task: OpenStruct.new(id: '0', action: action)
16
+ }
17
+ end
18
+ end
19
+
20
+ class QueryType < GraphQL::Schema::Object
21
+ field :tasks, TaskType.connection_type, null: false
22
+
23
+ def tasks()
24
+ [
25
+ OpenStruct.new(id: '0', action: 'Sample')
26
+ ]
27
+ end
28
+ end
29
+
30
+ class MutationType < GraphQL::Schema::Object
31
+ field :create_task, mutation: NewTaskType
32
+ end
33
+
34
+ class Schema < GraphQL::Schema
35
+ query QueryType
36
+ mutation MutationType
37
+ end
38
+
39
+ def test_it_works
40
+ assert defined?(GraphQL)
41
+ end
42
+
43
+ def test_config_defaults
44
+ assert ::Instana.config[:graphql].is_a?(Hash)
45
+ assert ::Instana.config[:graphql].key?(:enabled)
46
+ assert_equal true, ::Instana.config[:graphql][:enabled]
47
+ end
48
+
49
+ def test_query
50
+ clear_all!
51
+
52
+ query = "query Sample {
53
+ tasks(after: \"\", first: 10) {
54
+ nodes {
55
+ action
56
+ }
57
+ }
58
+ }"
59
+
60
+ expected_data = {
61
+ :operationName => "Sample",
62
+ :operationType => "query",
63
+ :arguments => { "tasks" => ["after", "first"] },
64
+ :fields => { "tasks" => ["nodes"], "nodes" => ["action"] }
65
+ }
66
+ expected_results = {
67
+ "data" => {
68
+ "tasks" => {
69
+ "nodes" => [{ "action" => "Sample" }]
70
+ }
71
+ }
72
+ }
73
+
74
+ results = Instana.tracer.start_or_continue_trace('graphql-test') { Schema.execute(query) }
75
+ query_span, root_span = *Instana.processor.queued_spans
76
+
77
+ assert_equal expected_results, results.to_h
78
+ assert_equal :sdk, root_span[:n]
79
+ assert_equal :'graphql.server', query_span[:n]
80
+ assert_equal expected_data, query_span[:data][:graphql]
81
+ end
82
+
83
+ def test_mutation
84
+ clear_all!
85
+
86
+ query = "mutation Sample {
87
+ createTask(action: \"Sample\") {
88
+ task {
89
+ action
90
+ }
91
+ }
92
+ }"
93
+
94
+ expected_data = {
95
+ :operationName => "Sample",
96
+ :operationType => "mutation",
97
+ :arguments => { "createTask" => ["action"] },
98
+ :fields => { "createTask" => ["task"], "task" => ["action"] }
99
+ }
100
+ expected_results = {
101
+ "data" => {
102
+ "createTask" => {
103
+ "task" => { "action" => "Sample" }
104
+ }
105
+ }
106
+ }
107
+
108
+ results = Instana.tracer.start_or_continue_trace('graphql-test') { Schema.execute(query) }
109
+ query_span, root_span = *Instana.processor.queued_spans
110
+
111
+ assert_equal expected_results, results.to_h
112
+ assert_equal :sdk, root_span[:n]
113
+ assert_equal :'graphql.server', query_span[:n]
114
+ assert_equal expected_data, query_span[:data][:graphql]
115
+ end
116
+ end
@@ -1,4 +1,5 @@
1
1
  require 'test_helper'
2
+ require 'support/apps/grpc/boot'
2
3
 
3
4
  class GrpcTest < Minitest::Test
4
5
  def client_stub
@@ -225,7 +226,7 @@ class GrpcTest < Minitest::Test
225
226
  server_span = find_spans_by_name(spans, :'rpc-server').first
226
227
 
227
228
  validate_sdk_span(sdk_span)
228
-
229
+
229
230
  assert_client_span(
230
231
  client_span,
231
232
  call: '/PingPongService/FailToPing',
@@ -1,4 +1,5 @@
1
1
  require 'test_helper'
2
+ require 'support/apps/http_endpoint/boot'
2
3
 
3
4
  class NetHTTPTest < Minitest::Test
4
5
  def test_config_defaults
@@ -0,0 +1,84 @@
1
+ require 'test_helper'
2
+
3
+ class RackInstrumentedRequestTest < Minitest::Test
4
+ def test_skip_trace_with_header
5
+ req = Instana::InstrumentedRequest.new(
6
+ 'HTTP_X_INSTANA_L' => '0;sample-data'
7
+ )
8
+
9
+ assert req.skip_trace?
10
+ end
11
+
12
+ def test_skip_trace_without_header
13
+ req = Instana::InstrumentedRequest.new({})
14
+
15
+ refute req.skip_trace?
16
+ end
17
+
18
+ def test_incomming_context
19
+ id = Instana::Util.generate_id
20
+ req = Instana::InstrumentedRequest.new(
21
+ 'HTTP_X_INSTANA_L' => '1',
22
+ 'HTTP_X_INSTANA_T' => id,
23
+ 'HTTP_X_INSTANA_S' => id
24
+ )
25
+
26
+ expected = {
27
+ trace_id: id,
28
+ span_id: id,
29
+ level: '1'
30
+ }
31
+
32
+ assert_equal expected, req.incoming_context
33
+ end
34
+
35
+ def test_request_tags
36
+ ::Instana.agent.extra_headers = %w[X-Capture-This]
37
+ req = Instana::InstrumentedRequest.new(
38
+ 'HTTP_HOST' => 'example.com',
39
+ 'REQUEST_METHOD' => 'GET',
40
+ 'HTTP_X_CAPTURE_THIS' => 'that',
41
+ 'PATH_INFO' => '/'
42
+ )
43
+
44
+ expected = {
45
+ method: 'GET',
46
+ url: '/',
47
+ host: 'example.com',
48
+ header: {
49
+ "X-Capture-This": 'that'
50
+ }
51
+ }
52
+
53
+ assert_equal expected, req.request_tags
54
+ ::Instana.agent.extra_headers = nil
55
+ end
56
+
57
+ def test_correlation_data_valid
58
+ req = Instana::InstrumentedRequest.new(
59
+ 'HTTP_X_INSTANA_L' => '1,correlationType=web ;correlationId=1234567890abcdef'
60
+ )
61
+ expected = {
62
+ type: 'web',
63
+ id: '1234567890abcdef'
64
+ }
65
+
66
+ assert_equal expected, req.correlation_data
67
+ end
68
+
69
+ def test_correlation_data_invalid
70
+ req = Instana::InstrumentedRequest.new(
71
+ 'HTTP_X_INSTANA_L' => '0;sample-data'
72
+ )
73
+
74
+ assert_equal({}, req.correlation_data)
75
+ end
76
+
77
+ def test_correlation_data_legacy
78
+ req = Instana::InstrumentedRequest.new(
79
+ 'HTTP_X_INSTANA_L' => '1'
80
+ )
81
+
82
+ assert_equal({}, req.correlation_data)
83
+ end
84
+ end
@@ -1,11 +1,10 @@
1
1
  require 'test_helper'
2
2
  require 'rack/test'
3
3
  require 'rack/lobster'
4
- require "instana/rack"
5
4
 
6
5
  class RackTest < Minitest::Test
7
6
  include Rack::Test::Methods
8
-
7
+
9
8
  class PathTemplateApp
10
9
  def call(env)
11
10
  env['INSTANA_HTTP_PATH_TEMPLATE'] = 'sample_template'
@@ -57,11 +56,7 @@ class RackTest < Minitest::Test
57
56
  assert rack_span[:f].key?(:e)
58
57
  assert rack_span[:f].key?(:h)
59
58
  assert_equal ::Instana.agent.agent_uuid, rack_span[:f][:h]
60
-
61
- # Backtrace fingerprint validation
62
- assert rack_span.key?(:stack)
63
- assert_equal 2, rack_span[:stack].count
64
- refute_nil rack_span[:stack].first[:c].match(/instana\/instrumentation\/rack.rb/)
59
+ assert !rack_span.key?(:stack)
65
60
 
66
61
  # Restore to default
67
62
  ::Instana.config[:collect_backtraces] = false
@@ -151,8 +146,9 @@ class RackTest < Minitest::Test
151
146
 
152
147
  def test_context_continuation
153
148
  clear_all!
154
- header 'X-INSTANA-T', Instana::Util.id_to_header(1234)
155
- header 'X-INSTANA-S', Instana::Util.id_to_header(4321)
149
+ continuation_id = Instana::Util.generate_id
150
+ header 'X-INSTANA-T', continuation_id
151
+ header 'X-INSTANA-S', continuation_id
156
152
 
157
153
  get '/mrlobster'
158
154
  assert last_response.ok?
@@ -186,10 +182,30 @@ class RackTest < Minitest::Test
186
182
  # Context validation
187
183
  # The first span should have the passed in trace ID
188
184
  # and specify the passed in span ID as it's parent.
189
- assert_equal 1234, rack_span[:t]
190
- assert_equal 4321, rack_span[:p]
185
+ assert_equal continuation_id, rack_span[:t]
186
+ assert_equal continuation_id, rack_span[:p]
191
187
  end
192
188
 
189
+ def test_correlation_information
190
+ clear_all!
191
+
192
+ header 'X-INSTANA-L', '1,correlationType=test;correlationId=abcdefh123'
193
+
194
+ get '/mrlobster'
195
+ assert last_response.ok?
196
+
197
+ spans = ::Instana.processor.queued_spans
198
+
199
+ # Span validation
200
+ assert_equal 1, spans.count
201
+ rack_span = spans.first
202
+ assert_equal :rack, rack_span[:n]
203
+
204
+ assert_equal 'abcdefh123', rack_span[:crid]
205
+ assert_equal 'test', rack_span[:crtp]
206
+ end
207
+
208
+
193
209
  def test_instana_response_headers
194
210
  clear_all!
195
211
  get '/mrlobster'
@@ -233,26 +249,22 @@ class RackTest < Minitest::Test
233
249
  assert rack_span[:data][:http][:header].key?(:"X-Capture-This")
234
250
  assert !rack_span[:data][:http][:header].key?(:"X-Capture-That")
235
251
  assert_equal "ThereYouGo", rack_span[:data][:http][:header][:"X-Capture-This"]
236
-
237
- # Backtrace fingerprint validation
238
- assert rack_span.key?(:stack)
239
- assert_equal 2, rack_span[:stack].count
240
- refute_nil rack_span[:stack].first[:c].match(/instana\/instrumentation\/rack.rb/)
252
+ assert !rack_span.key?(:stack)
241
253
 
242
254
  # Restore to default
243
255
  ::Instana.config[:collect_backtraces] = false
244
256
  ::Instana.agent.extra_headers = nil
245
257
  end
246
-
258
+
247
259
  def test_capture_http_path_template
248
260
  clear_all!
249
-
261
+
250
262
  get '/path_tpl'
251
263
  assert last_response.ok?
252
-
264
+
253
265
  spans = ::Instana.processor.queued_spans
254
266
  assert_equal 1, spans.length
255
-
267
+
256
268
  rack_span = spans.first
257
269
  assert_equal :rack, rack_span[:n]
258
270
  assert_equal 'sample_template', rack_span[:data][:http][:path_tpl]