instana 1.10.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +23 -0
  3. data/.gitignore +16 -0
  4. data/.rubocop.yml +1156 -0
  5. data/.travis.yml +43 -0
  6. data/Configuration.md +149 -0
  7. data/Dockerfile +13 -0
  8. data/Gemfile +41 -0
  9. data/LICENSE +21 -0
  10. data/README.md +102 -0
  11. data/Rakefile +56 -0
  12. data/Tracing.md +145 -0
  13. data/Troubleshooting.md +32 -0
  14. data/benchmarks/Gemfile +7 -0
  15. data/benchmarks/id_generation.rb +12 -0
  16. data/benchmarks/opentracing.rb +26 -0
  17. data/benchmarks/rack_vanilla_vs_traced.rb +80 -0
  18. data/benchmarks/stackprof_rack_tracing.rb +77 -0
  19. data/benchmarks/time_processing.rb +12 -0
  20. data/bin/console +7 -0
  21. data/bin/setup +8 -0
  22. data/examples/opentracing.rb +31 -0
  23. data/examples/tracing.rb +80 -0
  24. data/gemfiles/libraries.gemfile +71 -0
  25. data/gemfiles/rails32.gemfile +51 -0
  26. data/gemfiles/rails42.gemfile +50 -0
  27. data/gemfiles/rails50.gemfile +52 -0
  28. data/instana.gemspec +46 -0
  29. data/lib/instana.rb +12 -0
  30. data/lib/instana/agent.rb +441 -0
  31. data/lib/instana/agent/helpers.rb +61 -0
  32. data/lib/instana/agent/hooks.rb +37 -0
  33. data/lib/instana/agent/tasks.rb +48 -0
  34. data/lib/instana/base.rb +54 -0
  35. data/lib/instana/collector.rb +116 -0
  36. data/lib/instana/collectors/gc.rb +57 -0
  37. data/lib/instana/collectors/memory.rb +34 -0
  38. data/lib/instana/collectors/thread.rb +30 -0
  39. data/lib/instana/config.rb +79 -0
  40. data/lib/instana/eum/eum-test.js.erb +16 -0
  41. data/lib/instana/eum/eum.js.erb +14 -0
  42. data/lib/instana/frameworks/cuba.rb +6 -0
  43. data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +58 -0
  44. data/lib/instana/frameworks/instrumentation/action_controller.rb +183 -0
  45. data/lib/instana/frameworks/instrumentation/action_view.rb +43 -0
  46. data/lib/instana/frameworks/instrumentation/active_record.rb +27 -0
  47. data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +81 -0
  48. data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +56 -0
  49. data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +71 -0
  50. data/lib/instana/frameworks/rails.rb +42 -0
  51. data/lib/instana/frameworks/roda.rb +6 -0
  52. data/lib/instana/frameworks/sinatra.rb +9 -0
  53. data/lib/instana/helpers.rb +40 -0
  54. data/lib/instana/instrumentation.rb +21 -0
  55. data/lib/instana/instrumentation/dalli.rb +78 -0
  56. data/lib/instana/instrumentation/excon.rb +74 -0
  57. data/lib/instana/instrumentation/grpc.rb +84 -0
  58. data/lib/instana/instrumentation/net-http.rb +66 -0
  59. data/lib/instana/instrumentation/rack.rb +77 -0
  60. data/lib/instana/instrumentation/redis.rb +82 -0
  61. data/lib/instana/instrumentation/resque.rb +131 -0
  62. data/lib/instana/instrumentation/rest-client.rb +34 -0
  63. data/lib/instana/instrumentation/sidekiq-client.rb +45 -0
  64. data/lib/instana/instrumentation/sidekiq-worker.rb +54 -0
  65. data/lib/instana/opentracing/carrier.rb +4 -0
  66. data/lib/instana/opentracing/tracer.rb +18 -0
  67. data/lib/instana/rack.rb +10 -0
  68. data/lib/instana/setup.rb +36 -0
  69. data/lib/instana/test.rb +40 -0
  70. data/lib/instana/thread_local.rb +15 -0
  71. data/lib/instana/tracer.rb +392 -0
  72. data/lib/instana/tracing/processor.rb +92 -0
  73. data/lib/instana/tracing/span.rb +401 -0
  74. data/lib/instana/tracing/span_context.rb +33 -0
  75. data/lib/instana/util.rb +261 -0
  76. data/lib/instana/version.rb +4 -0
  77. data/lib/oj_check.rb +16 -0
  78. data/lib/opentracing.rb +6 -0
  79. data/test/agent/agent_test.rb +143 -0
  80. data/test/apps/cuba.rb +15 -0
  81. data/test/apps/grpc_server.rb +81 -0
  82. data/test/apps/roda.rb +10 -0
  83. data/test/apps/sinatra.rb +5 -0
  84. data/test/benchmarks/bench_id_generation.rb +12 -0
  85. data/test/benchmarks/bench_opentracing.rb +13 -0
  86. data/test/config_test.rb +37 -0
  87. data/test/frameworks/cuba_test.rb +44 -0
  88. data/test/frameworks/rack_test.rb +167 -0
  89. data/test/frameworks/rails/actioncontroller_test.rb +93 -0
  90. data/test/frameworks/rails/actionview3_test.rb +255 -0
  91. data/test/frameworks/rails/actionview4_test.rb +254 -0
  92. data/test/frameworks/rails/actionview5_test.rb +221 -0
  93. data/test/frameworks/rails/activerecord3_test.rb +134 -0
  94. data/test/frameworks/rails/activerecord4_test.rb +134 -0
  95. data/test/frameworks/rails/activerecord5_test.rb +87 -0
  96. data/test/frameworks/roda_test.rb +44 -0
  97. data/test/frameworks/sinatra_test.rb +44 -0
  98. data/test/instana_test.rb +27 -0
  99. data/test/instrumentation/dalli_test.rb +253 -0
  100. data/test/instrumentation/excon_test.rb +147 -0
  101. data/test/instrumentation/grpc_test.rb +377 -0
  102. data/test/instrumentation/net-http_test.rb +160 -0
  103. data/test/instrumentation/redis_test.rb +119 -0
  104. data/test/instrumentation/resque_test.rb +128 -0
  105. data/test/instrumentation/rest-client_test.rb +55 -0
  106. data/test/instrumentation/sidekiq-client_test.rb +125 -0
  107. data/test/instrumentation/sidekiq-worker_test.rb +173 -0
  108. data/test/jobs/resque_error_job.rb +22 -0
  109. data/test/jobs/resque_fast_job.rb +20 -0
  110. data/test/jobs/sidekiq_job_1.rb +6 -0
  111. data/test/jobs/sidekiq_job_2.rb +7 -0
  112. data/test/models/block.rb +18 -0
  113. data/test/servers/grpc_50051.rb +20 -0
  114. data/test/servers/helpers/sidekiq_worker_initializer.rb +27 -0
  115. data/test/servers/rackapp_6511.rb +25 -0
  116. data/test/servers/rails_3205.rb +167 -0
  117. data/test/servers/sidekiq/worker.rb +27 -0
  118. data/test/test_helper.rb +145 -0
  119. data/test/tracing/custom_test.rb +158 -0
  120. data/test/tracing/id_management_test.rb +130 -0
  121. data/test/tracing/opentracing_test.rb +335 -0
  122. data/test/tracing/trace_test.rb +67 -0
  123. data/test/tracing/tracer_async_test.rb +198 -0
  124. data/test/tracing/tracer_test.rb +223 -0
  125. metadata +327 -0
data/test/apps/cuba.rb ADDED
@@ -0,0 +1,15 @@
1
+ require "cuba/safe"
2
+
3
+ Cuba.plugin ::Cuba::Safe
4
+
5
+ Cuba.define do
6
+ on get do
7
+ on "hello" do
8
+ res.write "Hello Instana!"
9
+ end
10
+
11
+ on root do
12
+ res.redirect '/hello'
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,81 @@
1
+ require 'google/protobuf'
2
+
3
+ Google::Protobuf::DescriptorPool.generated_pool.build do
4
+ add_message "PingPongService.PingRequest" do
5
+ optional :message, :string, 1
6
+ end
7
+ add_message "PingPongService.PongReply" do
8
+ optional :message, :string, 1
9
+ end
10
+ end
11
+
12
+ module PingPongService
13
+ PingRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("PingPongService.PingRequest").msgclass
14
+ PongReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("PingPongService.PongReply").msgclass
15
+ end
16
+ require 'grpc'
17
+
18
+ module PingPongService
19
+ # The greeting service definition.
20
+ class Service
21
+ include GRPC::GenericService
22
+
23
+ self.marshal_class_method = :encode
24
+ self.unmarshal_class_method = :decode
25
+ self.service_name = 'PingPongService'
26
+
27
+ rpc :Ping, PingRequest, PongReply
28
+ rpc :PingWithClientStream, stream(PingRequest), PongReply
29
+ rpc :PingWithServerStream, PingRequest, stream(PongReply)
30
+ rpc :PingWithBidiStream, stream(PingRequest), stream(PongReply)
31
+
32
+ rpc :FailToPing, PingRequest, PongReply
33
+ rpc :FailToPingWithClientStream, stream(PingRequest), PongReply
34
+ rpc :FailToPingWithServerStream, PingRequest, stream(PongReply)
35
+ rpc :FailToPingWithBidiStream, stream(PingRequest), stream(PongReply)
36
+ end
37
+
38
+ Stub = Service.rpc_stub_class
39
+ end
40
+
41
+ class PingPongServer < PingPongService::Service
42
+ def ping(ping_request, active_call)
43
+ PingPongService::PongReply.new(message: "Hello #{ping_request.message}")
44
+ end
45
+
46
+ def ping_with_client_stream(active_call)
47
+ message = ''
48
+ active_call.each_remote_read do |req|
49
+ message += req.message
50
+ end
51
+ PingPongService::PongReply.new(message: message)
52
+ end
53
+
54
+ def ping_with_server_stream(ping_request, active_call)
55
+ (0..5).map do |index|
56
+ PingPongService::PongReply.new(message: index.to_s)
57
+ end
58
+ end
59
+
60
+ def ping_with_bidi_stream(ping_requests)
61
+ ping_requests.map do |ping_request|
62
+ PingPongService::PongReply.new(message: ping_request.message)
63
+ end
64
+ end
65
+
66
+ def fail_to_ping(ping_request, active_call)
67
+ raise 'Unexpected failed'
68
+ end
69
+
70
+ def fail_to_ping_with_client_stream(active_call)
71
+ raise 'Unexpected failed'
72
+ end
73
+
74
+ def fail_to_ping_with_server_stream(ping_request, active_call)
75
+ raise 'Unexpected failed'
76
+ end
77
+
78
+ def fail_to_ping_with_bidi_stream(ping_requests)
79
+ raise 'Unexpected failed'
80
+ end
81
+ end
data/test/apps/roda.rb ADDED
@@ -0,0 +1,10 @@
1
+ class InstanaRodaApp < Roda
2
+ route do |r|
3
+ r.root do
4
+ r.redirect '/hello'
5
+ end
6
+ r.get "hello" do
7
+ "Hello Roda + Instana"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class InstanaSinatraApp < ::Sinatra::Base
2
+ get '/' do
3
+ "Hello Sinatra!"
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ require 'test_helper'
2
+
3
+ class BenchIDs < Minitest::Benchmark
4
+ def bench_generate_id
5
+ # TODO: This performs poorly on JRuby.
6
+ assert_performance_constant do |input|
7
+ 500_000.times do
8
+ ::Instana::Util.generate_id
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+
3
+ class BenchOpenTracing < Minitest::Benchmark
4
+ def bench_start_finish_span
5
+ assert_performance_constant do |input|
6
+ 10_000.times do
7
+ span = ::Instana.tracer.start_span(:blah)
8
+ span.set_tag(:zero, 0)
9
+ span.finish
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+
3
+ class ConfigTest < Minitest::Test
4
+ def test_that_config_exists
5
+ refute_nil ::Instana.config
6
+ assert_instance_of(::Instana::Config, ::Instana.config)
7
+ end
8
+
9
+ def test_that_it_has_defaults
10
+ assert_equal '127.0.0.1', ::Instana.config[:agent_host]
11
+ assert_equal 42699, ::Instana.config[:agent_port]
12
+
13
+ assert ::Instana.config[:enabled]
14
+ assert ::Instana.config[:tracing][:enabled]
15
+ assert ::Instana.config[:metrics][:enabled]
16
+
17
+ ::Instana.config[:metrics].each do |k, v|
18
+ assert_equal true, ::Instana.config[:metrics][k].key?(:enabled)
19
+ end
20
+ end
21
+
22
+ def test_that_global_affects_children
23
+ # Disabling the gem should explicitly disable
24
+ # metrics and tracing flags
25
+ ::Instana.config[:enabled] = false
26
+
27
+ assert_equal false, ::Instana.config[:tracing][:enabled]
28
+ assert_equal false, ::Instana.config[:metrics][:enabled]
29
+
30
+ # Enabling the gem should explicitly enable
31
+ # metrics and tracing flags
32
+ ::Instana.config[:enabled] = true
33
+
34
+ assert_equal ::Instana.config[:tracing][:enabled]
35
+ assert_equal ::Instana.config[:metrics][:enabled]
36
+ end
37
+ end
@@ -0,0 +1,44 @@
1
+
2
+ if defined?(::Cuba)
3
+ require 'test_helper'
4
+ require File.expand_path(File.dirname(__FILE__) + '/../apps/cuba')
5
+ require 'rack/test'
6
+
7
+ class CubaTest < Minitest::Test
8
+ include Rack::Test::Methods
9
+
10
+ def app
11
+ Cuba
12
+ end
13
+
14
+ def test_basic_get
15
+ clear_all!
16
+
17
+ r = get '/hello'
18
+ assert last_response.ok?
19
+
20
+ assert r.headers.key?("X-Instana-T")
21
+ assert r.headers.key?("X-Instana-S")
22
+
23
+ spans = ::Instana.processor.queued_spans
24
+ assert_equal 1, spans.count
25
+
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
+
31
+ assert first_span[:data][:http].key?(:method)
32
+ assert_equal "GET", first_span[:data][:http][:method]
33
+
34
+ assert first_span[:data][:http].key?(:url)
35
+ assert_equal "/hello", first_span[:data][:http][:url]
36
+
37
+ assert first_span[:data][:http].key?(:status)
38
+ assert_equal 200, first_span[:data][:http][:status]
39
+
40
+ assert first_span[:data][:http].key?(:host)
41
+ assert_equal "example.org", first_span[:data][:http][:host]
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,167 @@
1
+ require 'test_helper'
2
+ require 'rack/test'
3
+ require 'rack/lobster'
4
+ require "instana/rack"
5
+
6
+ class RackTest < Minitest::Test
7
+ include Rack::Test::Methods
8
+
9
+ def app
10
+ @app = Rack::Builder.new {
11
+ use Rack::CommonLogger
12
+ use Rack::ShowExceptions
13
+ use Instana::Rack
14
+ map "/mrlobster" do
15
+ run Rack::Lobster.new
16
+ end
17
+ }
18
+ end
19
+
20
+ def test_basic_get
21
+ clear_all!
22
+ ::Instana.config[:collect_backtraces] = true
23
+
24
+ get '/mrlobster'
25
+ assert last_response.ok?
26
+
27
+ spans = ::Instana.processor.queued_spans
28
+
29
+ # Span validation
30
+ assert_equal 1, spans.count
31
+
32
+ first_span = spans.first
33
+ assert_equal :rack, first_span[:n]
34
+ assert first_span.key?(:data)
35
+ assert first_span[:data].key?(:http)
36
+ assert_equal "GET", first_span[:data][:http][:method]
37
+ assert_equal "/mrlobster", first_span[:data][:http][:url]
38
+ assert_equal 200, first_span[:data][:http][:status]
39
+ assert_equal 'example.org', first_span[:data][:http][:host]
40
+ assert first_span.key?(:f)
41
+ assert first_span[:f].key?(:e)
42
+ assert first_span[:f].key?(:h)
43
+ assert_equal ::Instana.agent.agent_uuid, first_span[:f][:h]
44
+
45
+ # Backtrace fingerprint validation
46
+ assert first_span.key?(:stack)
47
+ assert_equal 2, first_span[:stack].count
48
+ refute_nil first_span[:stack].first[:c].match(/instana\/instrumentation\/rack.rb/)
49
+ end
50
+
51
+ def test_basic_get_with_custom_service_name
52
+ ENV['INSTANA_SERVICE_NAME'] = 'WalterBishop'
53
+
54
+ clear_all!
55
+ get '/mrlobster'
56
+ assert last_response.ok?
57
+
58
+ spans = ::Instana.processor.queued_spans
59
+
60
+ # Span validation
61
+ assert_equal 1, spans.count
62
+
63
+ first_span = spans.first
64
+ assert_equal 'WalterBishop', first_span[:data][:service]
65
+
66
+ ENV.delete('INSTANA_SERVICE_NAME')
67
+ end
68
+
69
+ def test_basic_post
70
+ clear_all!
71
+ post '/mrlobster'
72
+ assert last_response.ok?
73
+
74
+ spans = ::Instana.processor.queued_spans
75
+
76
+ # Span validation
77
+ assert_equal 1, spans.count
78
+ first_span = spans.first
79
+ assert_equal :rack, first_span[:n]
80
+ assert first_span.key?(:data)
81
+ assert first_span[:data].key?(:http)
82
+ assert_equal "POST", first_span[:data][:http][:method]
83
+ assert_equal "/mrlobster", first_span[:data][:http][:url]
84
+ assert_equal 200, first_span[:data][:http][:status]
85
+ assert first_span.key?(:f)
86
+ assert first_span[:f].key?(:e)
87
+ assert first_span[:f].key?(:h)
88
+ assert_equal ::Instana.agent.agent_uuid, first_span[:f][:h]
89
+ end
90
+
91
+ def test_basic_put
92
+ clear_all!
93
+ put '/mrlobster'
94
+ assert last_response.ok?
95
+
96
+ spans = ::Instana.processor.queued_spans
97
+
98
+ # Span validation
99
+ assert_equal 1, spans.count
100
+ first_span = spans.first
101
+ assert_equal :rack, first_span[:n]
102
+ assert first_span.key?(:data)
103
+ assert first_span[:data].key?(:http)
104
+ assert_equal "PUT", first_span[:data][:http][:method]
105
+ assert_equal "/mrlobster", first_span[:data][:http][:url]
106
+ assert_equal 200, first_span[:data][:http][:status]
107
+ assert first_span.key?(:f)
108
+ assert first_span[:f].key?(:e)
109
+ assert first_span[:f].key?(:h)
110
+ assert_equal ::Instana.agent.agent_uuid, first_span[:f][:h]
111
+ end
112
+
113
+ def test_context_continuation
114
+ clear_all!
115
+ header 'X-INSTANA-T', Instana::Util.id_to_header(1234)
116
+ header 'X-INSTANA-S', Instana::Util.id_to_header(4321)
117
+
118
+ get '/mrlobster'
119
+ assert last_response.ok?
120
+
121
+ spans = ::Instana.processor.queued_spans
122
+
123
+ # Span validation
124
+ assert_equal 1, spans.count
125
+ first_span = spans.first
126
+ assert_equal :rack, first_span[:n]
127
+ assert first_span.key?(:data)
128
+ assert first_span[:data].key?(:http)
129
+ assert_equal "GET", first_span[:data][:http][:method]
130
+ assert_equal "/mrlobster", first_span[:data][:http][:url]
131
+ assert_equal 200, first_span[:data][:http][:status]
132
+ assert first_span.key?(:f)
133
+ assert first_span[:f].key?(:e)
134
+ assert first_span[:f].key?(:h)
135
+ assert_equal ::Instana.agent.agent_uuid, first_span[:f][:h]
136
+
137
+ # Context validation
138
+ # The first span should have the passed in trace ID
139
+ # and specify the passed in span ID as it's parent.
140
+ assert_equal 1234, first_span[:t]
141
+ assert_equal 4321, first_span[:p]
142
+ end
143
+
144
+ def test_instana_response_headers
145
+ clear_all!
146
+ get '/mrlobster'
147
+ assert last_response.ok?
148
+
149
+ refute_nil last_response.headers.key?("X-Instana-T")
150
+ refute_nil last_response.headers.key?("X-Instana-S")
151
+ end
152
+
153
+ def test_that_url_params_not_logged
154
+ clear_all!
155
+ get '/mrlobster?blah=2&wilma=1&betty=2;fred=3'
156
+
157
+ spans = ::Instana.processor.queued_spans
158
+ assert_equal 1, spans.length
159
+
160
+ refute_nil spans.first.key?(:data)
161
+ refute_nil spans.first[:data].key?(:http)
162
+ refute_nil spans.first[:data][:http].key?(:url)
163
+ assert_equal '/mrlobster', spans.first[:data][:http][:url]
164
+
165
+ assert last_response.ok?
166
+ end
167
+ end
@@ -0,0 +1,93 @@
1
+ require 'test_helper'
2
+
3
+ class ActionControllerTest < Minitest::Test
4
+ def test_config_defaults
5
+ assert ::Instana.config[:action_controller].is_a?(Hash)
6
+ assert ::Instana.config[:action_controller].key?(:enabled)
7
+ assert_equal true, ::Instana.config[:action_controller][:enabled]
8
+ end
9
+
10
+ def test_controller_reporting
11
+ clear_all!
12
+
13
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/world'))
14
+
15
+ spans = ::Instana.processor.queued_spans
16
+ assert_equal 3, spans.length
17
+
18
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
19
+
20
+ assert_equal "TestController", ac_span[:data][:actioncontroller][:controller]
21
+ assert_equal "world", ac_span[:data][:actioncontroller][:action]
22
+ end
23
+
24
+ def test_controller_error
25
+ clear_all!
26
+
27
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/error'))
28
+
29
+ spans = ::Instana.processor.queued_spans
30
+ assert_equal 2, spans.length
31
+
32
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
33
+
34
+ assert_equal "TestController", ac_span[:data][:actioncontroller][:controller]
35
+ assert_equal "error", ac_span[:data][:actioncontroller][:action]
36
+ assert ac_span.key?(:error)
37
+ assert ac_span.key?(:stack)
38
+ assert_equal "Warning: This is a simulated Error", ac_span[:data][:log][:message]
39
+ assert_equal "Exception", ac_span[:data][:log][:parameters]
40
+ end
41
+
42
+ def test_api_controller_reporting
43
+ # Run only when ActionController::API is used/defined
44
+ skip unless defined?(::ActionController::API)
45
+
46
+ clear_all!
47
+
48
+ Net::HTTP.get(URI.parse('http://localhost:3205/api/world'))
49
+
50
+ spans = ::Instana.processor.queued_spans
51
+ assert_equal 3, spans.length
52
+
53
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
54
+
55
+ assert_equal :actioncontroller, ac_span[:n]
56
+ assert_equal "SocketController", ac_span[:data][:actioncontroller][:controller]
57
+ assert_equal "world", ac_span[:data][:actioncontroller][:action]
58
+ end
59
+
60
+ def test_api_controller_error
61
+ # Run only when ActionController::API is used/defined
62
+ skip unless defined?(::ActionController::API)
63
+
64
+ clear_all!
65
+
66
+ Net::HTTP.get(URI.parse('http://localhost:3205/api/error'))
67
+
68
+ spans = ::Instana.processor.queued_spans
69
+ assert_equal 2, spans.length
70
+
71
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
72
+
73
+ assert_equal "SocketController", ac_span[:data][:actioncontroller][:controller]
74
+ assert_equal "error", ac_span[:data][:actioncontroller][:action]
75
+ assert ac_span.key?(:error)
76
+ assert ac_span.key?(:stack)
77
+ assert_equal "Warning: This is a simulated Socket API Error", ac_span[:data][:log][:message]
78
+ assert_equal "Exception", ac_span[:data][:log][:parameters]
79
+ end
80
+
81
+ def test_404
82
+ clear_all!
83
+
84
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/404'))
85
+
86
+ spans = ::Instana.processor.queued_spans
87
+ assert_equal 1, spans.length
88
+
89
+ first_span = spans[0]
90
+
91
+ assert_equal :rack, first_span[:n]
92
+ end
93
+ end