instana 1.193.2 → 1.193.3.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +194 -133
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +5 -1147
  5. data/.rubocop_todo.yml +1140 -0
  6. data/Appraisals +96 -0
  7. data/Gemfile +11 -32
  8. data/Rakefile +16 -39
  9. data/bin/console +5 -4
  10. data/gemfiles/.bundle/config +1 -2
  11. data/gemfiles/cuba_30.gemfile +14 -0
  12. data/gemfiles/dalli_20.gemfile +14 -0
  13. data/gemfiles/excon_02.gemfile +14 -0
  14. data/gemfiles/graphql_10.gemfile +14 -0
  15. data/gemfiles/grpc_10.gemfile +14 -0
  16. data/gemfiles/net_http_01.gemfile +13 -0
  17. data/gemfiles/rack_16.gemfile +14 -0
  18. data/gemfiles/rack_20.gemfile +14 -0
  19. data/gemfiles/rails_42.gemfile +16 -0
  20. data/gemfiles/rails_50.gemfile +16 -0
  21. data/gemfiles/rails_52.gemfile +16 -0
  22. data/gemfiles/rails_60.gemfile +16 -0
  23. data/gemfiles/redis_40.gemfile +14 -0
  24. data/gemfiles/resque_122.gemfile +15 -0
  25. data/gemfiles/resque_20.gemfile +14 -0
  26. data/gemfiles/rest_client_16.gemfile +14 -0
  27. data/gemfiles/rest_client_20.gemfile +14 -0
  28. data/gemfiles/roda_20.gemfile +14 -0
  29. data/gemfiles/roda_30.gemfile +14 -0
  30. data/gemfiles/sidekiq_42.gemfile +14 -0
  31. data/gemfiles/sidekiq_50.gemfile +14 -0
  32. data/gemfiles/sinatra_14.gemfile +14 -0
  33. data/instana.gemspec +1 -7
  34. data/lib/instana/activator.rb +41 -0
  35. data/lib/instana/activators/cuba.rb +18 -0
  36. data/lib/instana/activators/dalli.rb +20 -0
  37. data/lib/instana/activators/excon.rb +17 -0
  38. data/lib/instana/activators/graphql.rb +19 -0
  39. data/lib/instana/activators/grpc_client.rb +17 -0
  40. data/lib/instana/activators/grpc_server.rb +17 -0
  41. data/lib/instana/activators/net_http.rb +17 -0
  42. data/lib/instana/activators/rack.rb +13 -0
  43. data/lib/instana/activators/rails.rb +15 -0
  44. data/lib/instana/activators/redis.rb +17 -0
  45. data/lib/instana/activators/resque_client.rb +18 -0
  46. data/lib/instana/activators/resque_worker.rb +30 -0
  47. data/lib/instana/activators/rest_client.rb +17 -0
  48. data/lib/instana/activators/roda.rb +18 -0
  49. data/lib/instana/activators/sidekiq_client.rb +21 -0
  50. data/lib/instana/activators/sidekiq_worker.rb +21 -0
  51. data/lib/instana/activators/sinatra.rb +18 -0
  52. data/lib/instana/frameworks/cuba.rb +6 -13
  53. data/lib/instana/frameworks/rails.rb +0 -1
  54. data/lib/instana/frameworks/roda.rb +7 -13
  55. data/lib/instana/frameworks/sinatra.rb +1 -8
  56. data/lib/instana/instrumentation/dalli.rb +0 -6
  57. data/lib/instana/instrumentation/excon.rb +51 -57
  58. data/lib/instana/instrumentation/graphql.rb +16 -18
  59. data/lib/instana/instrumentation/grpc.rb +4 -10
  60. data/lib/instana/instrumentation/instrumented_request.rb +2 -1
  61. data/lib/instana/instrumentation/net-http.rb +2 -5
  62. data/lib/instana/instrumentation/rack.rb +1 -0
  63. data/lib/instana/instrumentation/redis.rb +0 -5
  64. data/lib/instana/instrumentation/resque.rb +0 -25
  65. data/lib/instana/instrumentation/rest-client.rb +0 -5
  66. data/lib/instana/instrumentation/sidekiq-client.rb +0 -9
  67. data/lib/instana/instrumentation/sidekiq-worker.rb +0 -9
  68. data/lib/instana/setup.rb +3 -1
  69. data/lib/instana/version.rb +1 -1
  70. data/test/activator_test.rb +27 -0
  71. data/test/frameworks/cuba_test.rb +38 -40
  72. data/test/frameworks/rails/activerecord_test.rb +13 -13
  73. data/test/frameworks/rails_test.rb +15 -0
  74. data/test/frameworks/roda_test.rb +39 -41
  75. data/test/frameworks/sinatra_test.rb +61 -64
  76. data/test/instrumentation/excon_test.rb +1 -0
  77. data/test/instrumentation/grpc_test.rb +2 -1
  78. data/test/instrumentation/{net-http_test.rb → net_http_test.rb} +1 -0
  79. data/test/instrumentation/{instrumented_request_test.rb → rack_instrumented_request_test.rb} +1 -1
  80. data/test/{frameworks → instrumentation}/rack_test.rb +0 -1
  81. data/test/instrumentation/resque_test.rb +3 -11
  82. data/test/instrumentation/{rest-client_test.rb → rest_client_test.rb} +6 -0
  83. data/test/instrumentation/sidekiq-client_test.rb +1 -0
  84. data/test/instrumentation/sidekiq-worker_test.rb +1 -0
  85. data/test/{servers/grpc_50051.rb → support/apps/grpc/boot.rb} +1 -1
  86. data/test/{apps → support/apps/grpc}/grpc_server.rb +0 -0
  87. data/test/{servers/rackapp_6511.rb → support/apps/http_endpoint/boot.rb} +0 -0
  88. data/test/{servers/rails_3205.rb → support/apps/rails/boot.rb} +8 -14
  89. data/test/{models → support/apps/rails/models}/block.rb +1 -1
  90. data/test/{models → support/apps/rails/models}/block6.rb +0 -0
  91. data/test/support/apps/resque/boot.rb +2 -0
  92. data/test/{jobs → support/apps/resque/jobs}/resque_error_job.rb +0 -0
  93. data/test/{jobs → support/apps/resque/jobs}/resque_fast_job.rb +0 -0
  94. data/test/support/apps/sidekiq/boot.rb +21 -0
  95. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_1.rb +0 -0
  96. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_2.rb +0 -0
  97. data/test/{servers → support/apps}/sidekiq/worker.rb +2 -2
  98. data/test/support/helpers.rb +94 -0
  99. data/test/test_helper.rb +24 -138
  100. metadata +89 -81
  101. data/gemfiles/libraries.gemfile +0 -73
  102. data/gemfiles/rails32.gemfile +0 -51
  103. data/gemfiles/rails42.gemfile +0 -50
  104. data/gemfiles/rails50.gemfile +0 -52
  105. data/gemfiles/rails52.gemfile +0 -52
  106. data/gemfiles/rails60.gemfile +0 -72
  107. data/lib/instana/instrumentation.rb +0 -25
  108. data/lib/instana/test.rb +0 -43
  109. data/test/apps/cuba.rb +0 -19
  110. data/test/apps/roda.rb +0 -13
  111. data/test/apps/sinatra.rb +0 -9
  112. data/test/servers/helpers/sidekiq_worker_initializer.rb +0 -27
@@ -1,6 +1,7 @@
1
1
  # Note: We really only need "cgi/util" here but Ruby 2.4.1 has an issue:
2
2
  # https://bugs.ruby-lang.org/issues/13539
3
- require "cgi"
3
+ require 'cgi'
4
+ require 'rack/request'
4
5
 
5
6
  module Instana
6
7
  class InstrumentedRequest < Rack::Request
@@ -1,7 +1,7 @@
1
1
  require 'net/http'
2
2
 
3
- if defined?(::Net::HTTP) && ::Instana.config[:nethttp][:enabled]
4
- module Instana
3
+ module Instana
4
+ module Instrumentation
5
5
  module NetHTTPInstrumentation
6
6
  def request(*args, &block)
7
7
  if !Instana.tracer.tracing? || !started?
@@ -54,7 +54,4 @@ if defined?(::Net::HTTP) && ::Instana.config[:nethttp][:enabled]
54
54
  end
55
55
  end
56
56
  end
57
-
58
- ::Instana.logger.debug "Instrumenting Net::HTTP"
59
- Net::HTTP.prepend(::Instana::NetHTTPInstrumentation)
60
57
  end
@@ -1,3 +1,4 @@
1
+ require 'rack'
1
2
  require 'instana/instrumentation/instrumented_request'
2
3
 
3
4
  module Instana
@@ -60,8 +60,3 @@ module Instana
60
60
  end
61
61
  end
62
62
  end
63
-
64
- if defined?(::Redis) && ::Instana.config[:redis][:enabled]
65
- ::Instana.logger.debug "Instrumenting Redis"
66
- Redis::Client.prepend(::Instana::RedisInstrumentation)
67
- end
@@ -93,28 +93,3 @@ module Instana
93
93
  end
94
94
  end
95
95
  end
96
-
97
- if defined?(::Resque) && RUBY_VERSION >= '1.9.3'
98
-
99
- if ::Instana.config[:'resque-client'][:enabled]
100
- ::Instana.logger.debug 'Instrumenting Resque Client'
101
- ::Resque.prepend(::Instana::Instrumentation::ResqueClient)
102
- end
103
-
104
- if ::Instana.config[:'resque-worker'][:enabled]
105
- ::Instana.logger.debug 'Instrumenting Resque Worker'
106
-
107
- ::Resque::Worker.prepend(::Instana::Instrumentation::ResqueWorker)
108
- ::Resque::Job.prepend(::Instana::Instrumentation::ResqueJob)
109
-
110
- ::Resque.before_fork do |job|
111
- ::Instana.agent.before_resque_fork
112
- end
113
- ::Resque.after_fork do |job|
114
- ::Instana.agent.after_resque_fork
115
- end
116
-
117
- # Set this so we assure that any remaining collected traces are reported at_exit
118
- ENV['RUN_AT_EXIT_HOOKS'] = "1"
119
- end
120
- end
@@ -17,8 +17,3 @@ module Instana
17
17
  end
18
18
  end
19
19
  end
20
-
21
- if defined?(::RestClient::Request) && ::Instana.config[:'rest-client'][:enabled]
22
- ::Instana.logger.debug "Instrumenting RestClient"
23
- ::RestClient::Request.send(:prepend, ::Instana::Instrumentation::RestClientRequest)
24
- end
@@ -34,12 +34,3 @@ module Instana
34
34
  end
35
35
  end
36
36
  end
37
-
38
- if defined?(::Sidekiq) && ::Instana.config[:'sidekiq-client'][:enabled]
39
- ::Sidekiq.configure_client do |cfg|
40
- cfg.client_middleware do |chain|
41
- ::Instana.logger.debug "Instrumenting Sidekiq client"
42
- chain.add ::Instana::Instrumentation::SidekiqClient
43
- end
44
- end
45
- end
@@ -43,12 +43,3 @@ module Instana
43
43
  end
44
44
  end
45
45
  end
46
-
47
- if defined?(::Sidekiq) && ::Instana.config[:'sidekiq-worker'][:enabled]
48
- ::Sidekiq.configure_server do |cfg|
49
- cfg.server_middleware do |chain|
50
- ::Instana.logger.debug "Instrumenting Sidekiq worker"
51
- chain.add ::Instana::Instrumentation::SidekiqWorker
52
- end
53
- end
54
- end
data/lib/instana/setup.rb CHANGED
@@ -7,10 +7,12 @@ require "instana/collector"
7
7
  require "instana/secrets"
8
8
  require "instana/tracer"
9
9
  require "instana/tracing/processor"
10
- require "instana/instrumentation"
10
+
11
+ require 'instana/activator'
11
12
 
12
13
  ::Instana.setup
13
14
  ::Instana.agent.setup
15
+ ::Instana::Activator.start
14
16
 
15
17
  # Register the metric collectors
16
18
  unless RUBY_PLATFORM == 'java'.freeze
@@ -1,4 +1,4 @@
1
1
  module Instana
2
- VERSION = "1.193.2"
2
+ VERSION = "1.193.3.pre1"
3
3
  VERSION_FULL = "instana-#{VERSION}"
4
4
  end
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+
3
+ class ActivatorTest < Minitest::Test
4
+ def test_start
5
+ refute_nil Instana::Activator.trace_point
6
+ assert Instana::Activator.trace_point.enabled?
7
+ end
8
+
9
+ def test_klass_call
10
+ assert_equal [], Instana::Activator.call
11
+ end
12
+
13
+ def test_instance_call
14
+ subject = Class.new(Instana::Activator) do
15
+ def can_instrument?
16
+ true
17
+ end
18
+
19
+ def instrument
20
+ true
21
+ end
22
+ end
23
+
24
+ assert_equal 1, Instana::Activator.call.length
25
+ assert subject.call
26
+ end
27
+ end
@@ -1,57 +1,55 @@
1
- if defined?(::Cuba)
2
- require 'test_helper'
3
- require File.expand_path(File.dirname(__FILE__) + '/../apps/cuba')
4
- require 'rack/test'
1
+ require 'test_helper'
2
+ require 'rack/test'
5
3
 
6
- class CubaTest < Minitest::Test
7
- include Rack::Test::Methods
4
+ class CubaTest < Minitest::Test
5
+ include Rack::Test::Methods
6
+ APP = Rack::Builder.parse_file('test/support/apps/cuba/config.ru').first
8
7
 
9
- def app
10
- Cuba
11
- end
8
+ def app
9
+ APP
10
+ end
12
11
 
13
- def test_basic_get
14
- clear_all!
12
+ def test_basic_get
13
+ clear_all!
15
14
 
16
- r = get '/hello'
17
- assert last_response.ok?
15
+ r = get '/hello'
16
+ assert last_response.ok?
18
17
 
19
- assert r.headers.key?("X-Instana-T")
20
- assert r.headers.key?("X-Instana-S")
18
+ assert r.headers.key?("X-Instana-T")
19
+ assert r.headers.key?("X-Instana-S")
21
20
 
22
- spans = ::Instana.processor.queued_spans
23
- assert_equal 1, spans.count
21
+ spans = ::Instana.processor.queued_spans
22
+ assert_equal 1, spans.count
24
23
 
25
- first_span = spans.first
26
- assert_equal :rack, first_span[:n]
27
- assert first_span.key?(:data)
28
- assert first_span[:data].key?(:http)
24
+ first_span = spans.first
25
+ assert_equal :rack, first_span[:n]
26
+ assert first_span.key?(:data)
27
+ assert first_span[:data].key?(:http)
29
28
 
30
- assert first_span[:data][:http].key?(:method)
31
- assert_equal "GET", first_span[:data][:http][:method]
29
+ assert first_span[:data][:http].key?(:method)
30
+ assert_equal "GET", first_span[:data][:http][:method]
32
31
 
33
- assert first_span[:data][:http].key?(:url)
34
- assert_equal "/hello", first_span[:data][:http][:url]
32
+ assert first_span[:data][:http].key?(:url)
33
+ assert_equal "/hello", first_span[:data][:http][:url]
35
34
 
36
- assert first_span[:data][:http].key?(:status)
37
- assert_equal 200, first_span[:data][:http][:status]
35
+ assert first_span[:data][:http].key?(:status)
36
+ assert_equal 200, first_span[:data][:http][:status]
38
37
 
39
- assert first_span[:data][:http].key?(:host)
40
- assert_equal "example.org", first_span[:data][:http][:host]
41
- end
38
+ assert first_span[:data][:http].key?(:host)
39
+ assert_equal "example.org", first_span[:data][:http][:host]
40
+ end
42
41
 
43
- def test_path_template
44
- clear_all!
42
+ def test_path_template
43
+ clear_all!
45
44
 
46
- r = get '/greet/instana'
47
- assert last_response.ok?
45
+ r = get '/greet/instana'
46
+ assert last_response.ok?
48
47
 
49
- spans = ::Instana.processor.queued_spans
50
- assert_equal 1, spans.count
48
+ spans = ::Instana.processor.queued_spans
49
+ assert_equal 1, spans.count
51
50
 
52
- first_span = spans.first
53
- assert_equal :rack, first_span[:n]
54
- assert_equal '/greet/{name}', first_span[:data][:http][:path_tpl]
55
- end
51
+ first_span = spans.first
52
+ assert_equal :rack, first_span[:n]
53
+ assert_equal '/greet/{name}', first_span[:data][:http][:path_tpl]
56
54
  end
57
55
  end
@@ -16,7 +16,7 @@ class ActiveRecordTest < Minitest::Test
16
16
  end
17
17
 
18
18
  def test_postgresql
19
- skip unless ::Instana::Test.postgresql?
19
+ skip unless has_postgres_database?
20
20
 
21
21
  clear_all!
22
22
 
@@ -41,7 +41,7 @@ class ActiveRecordTest < Minitest::Test
41
41
  sql = "INSERT INTO \"blocks\" (\"name\", \"color\", \"created_at\", \"updated_at\") VALUES ($?, $?, $?, $?) RETURNING \"id\""
42
42
  end
43
43
  ar_span = find_first_span_by_qualifier(ar_spans) do |span|
44
- span[:data][:activerecord][:sql] == sql
44
+ span[:data][:activerecord][:sql].squeeze == sql.squeeze
45
45
  end
46
46
 
47
47
  found = false
@@ -53,7 +53,7 @@ class ActiveRecordTest < Minitest::Test
53
53
  sql = "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = ? LIMIT ?"
54
54
  end
55
55
  ar_span = find_first_span_by_qualifier(ar_spans) do |span|
56
- span[:data][:activerecord][:sql] == sql
56
+ span[:data][:activerecord][:sql].squeeze == sql.squeeze
57
57
  end
58
58
 
59
59
  found = false
@@ -63,12 +63,12 @@ class ActiveRecordTest < Minitest::Test
63
63
  sql = "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = $?"
64
64
  end
65
65
  ar_span = find_first_span_by_qualifier(ar_spans) do |span|
66
- span[:data][:activerecord][:sql] == sql
66
+ span[:data][:activerecord][:sql].squeeze == sql.squeeze
67
67
  end
68
68
  end
69
69
 
70
70
  def test_postgresql_without_sanitize
71
- skip unless ::Instana::Test.postgresql?
71
+ skip unless has_postgres_database?
72
72
 
73
73
  # Shut SQL sanitization off
74
74
  ::Instana.config[:sanitize_sql] = false
@@ -98,7 +98,7 @@ class ActiveRecordTest < Minitest::Test
98
98
  sql = "INSERT INTO \"blocks\" (\"name\", \"color\", \"created_at\", \"updated_at\") VALUES ($1, $2, $3, $4) RETURNING \"id\""
99
99
  end
100
100
  ar_span = find_first_span_by_qualifier(ar_spans) do |span|
101
- span[:data][:activerecord][:sql] == sql
101
+ span[:data][:activerecord][:sql].squeeze == sql.squeeze
102
102
  end
103
103
  assert ar_span[:data][:activerecord].key?(:binds)
104
104
  assert ar_span[:data][:activerecord][:binds].is_a?(Array)
@@ -112,7 +112,7 @@ class ActiveRecordTest < Minitest::Test
112
112
  sql = "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = ? LIMIT ?"
113
113
  end
114
114
  ar_span = find_first_span_by_qualifier(ar_spans) do |span|
115
- span[:data][:activerecord][:sql] == sql
115
+ span[:data][:activerecord][:sql].squeeze == sql.squeeze
116
116
  end
117
117
  assert ar_span[:data][:activerecord].key?(:binds)
118
118
  assert ar_span[:data][:activerecord][:binds].is_a?(Array)
@@ -124,7 +124,7 @@ class ActiveRecordTest < Minitest::Test
124
124
  sql = "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = $1"
125
125
  end
126
126
  ar_span = find_first_span_by_qualifier(ar_spans) do |span|
127
- span[:data][:activerecord][:sql] == sql
127
+ span[:data][:activerecord][:sql].squeeze == sql.squeeze
128
128
  end
129
129
  assert ar_span[:data][:activerecord].key?(:binds)
130
130
  assert ar_span[:data][:activerecord][:binds].is_a?(Array)
@@ -132,7 +132,7 @@ class ActiveRecordTest < Minitest::Test
132
132
  end
133
133
 
134
134
  def test_postgresql_lock_table
135
- skip unless ::Instana::Test.postgresql?
135
+ skip unless has_postgres_database?
136
136
 
137
137
  clear_all!
138
138
 
@@ -163,7 +163,7 @@ class ActiveRecordTest < Minitest::Test
163
163
  end
164
164
 
165
165
  def test_postgresql_raw_execute
166
- skip unless ::Instana::Test.postgresql?
166
+ skip unless has_postgres_database?
167
167
 
168
168
  clear_all!
169
169
 
@@ -183,7 +183,7 @@ class ActiveRecordTest < Minitest::Test
183
183
  end
184
184
 
185
185
  def test_postgresql_raw_execute_error
186
- skip unless ::Instana::Test.postgresql?
186
+ skip unless has_postgres_database?
187
187
 
188
188
  clear_all!
189
189
 
@@ -205,7 +205,7 @@ class ActiveRecordTest < Minitest::Test
205
205
  end
206
206
 
207
207
  def test_mysql2
208
- skip unless ::Instana::Test.mysql2?
208
+ skip unless has_mysql2_database?
209
209
 
210
210
  clear_all!
211
211
 
@@ -242,7 +242,7 @@ class ActiveRecordTest < Minitest::Test
242
242
  end
243
243
 
244
244
  def test_mysql
245
- skip unless ::Instana::Test.mysql?
245
+ skip unless has_mysql_database?
246
246
 
247
247
  clear_all!
248
248
 
@@ -0,0 +1,15 @@
1
+ require 'test_helper'
2
+
3
+ require 'support/apps/rails/boot'
4
+
5
+ require_relative 'rails/actioncontroller_test'
6
+ require_relative 'rails/activerecord_test'
7
+
8
+ case Rails::VERSION::MAJOR
9
+ when 3
10
+ require_relative 'rails/actionview3_test'
11
+ when 4
12
+ require_relative 'rails/actionview4_test'
13
+ else
14
+ require_relative 'rails/actionview5_test'
15
+ end
@@ -1,58 +1,56 @@
1
1
 
2
- if defined?(::Roda)
3
- require 'test_helper'
4
- require File.expand_path(File.dirname(__FILE__) + '/../apps/roda')
5
- require 'rack/test'
2
+ require 'test_helper'
3
+ require 'rack/test'
6
4
 
7
- class RodaTest < Minitest::Test
8
- include Rack::Test::Methods
5
+ class RodaTest < Minitest::Test
6
+ include Rack::Test::Methods
7
+ APP = Rack::Builder.parse_file('test/support/apps/roda/config.ru').first
9
8
 
10
- def app
11
- InstanaRodaApp
12
- end
9
+ def app
10
+ APP
11
+ end
12
+
13
+ def test_basic_get
14
+ clear_all!
13
15
 
14
- def test_basic_get
15
- clear_all!
16
+ r = get '/hello'
17
+ assert last_response.ok?
16
18
 
17
- r = get '/hello'
18
- assert last_response.ok?
19
+ assert r.headers.key?("X-Instana-T")
20
+ assert r.headers.key?("X-Instana-S")
19
21
 
20
- assert r.headers.key?("X-Instana-T")
21
- assert r.headers.key?("X-Instana-S")
22
+ spans = ::Instana.processor.queued_spans
23
+ assert_equal 1, spans.count
22
24
 
23
- spans = ::Instana.processor.queued_spans
24
- assert_equal 1, spans.count
25
+ first_span = spans.first
26
+ assert_equal :rack, first_span[:n]
27
+ assert first_span.key?(:data)
28
+ assert first_span[:data].key?(:http)
25
29
 
26
- first_span = spans.first
27
- assert_equal :rack, first_span[:n]
28
- assert first_span.key?(:data)
29
- assert first_span[:data].key?(:http)
30
+ assert first_span[:data][:http].key?(:method)
31
+ assert_equal "GET", first_span[:data][:http][:method]
30
32
 
31
- assert first_span[:data][:http].key?(:method)
32
- assert_equal "GET", first_span[:data][:http][:method]
33
+ assert first_span[:data][:http].key?(:url)
34
+ assert_equal "/hello", first_span[:data][:http][:url]
33
35
 
34
- assert first_span[:data][:http].key?(:url)
35
- assert_equal "/hello", first_span[:data][:http][:url]
36
+ assert first_span[:data][:http].key?(:status)
37
+ assert_equal 200, first_span[:data][:http][:status]
36
38
 
37
- assert first_span[:data][:http].key?(:status)
38
- assert_equal 200, first_span[:data][:http][:status]
39
+ assert first_span[:data][:http].key?(:host)
40
+ assert_equal "example.org", first_span[:data][:http][:host]
41
+ end
39
42
 
40
- assert first_span[:data][:http].key?(:host)
41
- assert_equal "example.org", first_span[:data][:http][:host]
42
- end
43
-
44
- def test_path_template
45
- clear_all!
43
+ def test_path_template
44
+ clear_all!
46
45
 
47
- r = get '/greet/instana'
48
- assert last_response.ok?
46
+ r = get '/greet/instana'
47
+ assert last_response.ok?
49
48
 
50
- spans = ::Instana.processor.queued_spans
51
- assert_equal 1, spans.count
49
+ spans = ::Instana.processor.queued_spans
50
+ assert_equal 1, spans.count
52
51
 
53
- first_span = spans.first
54
- assert_equal :rack, first_span[:n]
55
- assert_equal '/greet/{name}', first_span[:data][:http][:path_tpl]
56
- end
52
+ first_span = spans.first
53
+ assert_equal :rack, first_span[:n]
54
+ assert_equal '/greet/{name}', first_span[:data][:http][:path_tpl]
57
55
  end
58
56
  end