instana 1.192.1 → 1.193.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +200 -133
  3. data/.gitignore +3 -0
  4. data/.rubocop.yml +10 -1145
  5. data/.rubocop_todo.yml +1140 -0
  6. data/Appraisals +103 -0
  7. data/Gemfile +14 -32
  8. data/LICENSE +2 -1
  9. data/Rakefile +19 -39
  10. data/benchmarks/10k-rack-traces.rb +3 -0
  11. data/benchmarks/Gemfile +4 -0
  12. data/benchmarks/id_generation.rb +4 -0
  13. data/benchmarks/opentracing.rb +4 -0
  14. data/benchmarks/rack_vanilla_vs_traced.rb +3 -0
  15. data/benchmarks/stackprof_rack_tracing.rb +3 -0
  16. data/benchmarks/time_processing.rb +4 -0
  17. data/bin/console +8 -4
  18. data/examples/opentracing.rb +4 -0
  19. data/examples/tracing.rb +4 -0
  20. data/extras/license_header.rb +44 -0
  21. data/gemfiles/.bundle/config +1 -2
  22. data/gemfiles/cuba_30.gemfile +18 -0
  23. data/gemfiles/dalli_20.gemfile +18 -0
  24. data/gemfiles/excon_02.gemfile +18 -0
  25. data/gemfiles/graphql_10.gemfile +18 -0
  26. data/gemfiles/grpc_10.gemfile +18 -0
  27. data/gemfiles/net_http_01.gemfile +17 -0
  28. data/gemfiles/rack_16.gemfile +18 -0
  29. data/gemfiles/rack_20.gemfile +18 -0
  30. data/gemfiles/rails_42.gemfile +21 -0
  31. data/gemfiles/rails_50.gemfile +21 -0
  32. data/gemfiles/rails_52.gemfile +21 -0
  33. data/gemfiles/rails_60.gemfile +21 -0
  34. data/gemfiles/redis_40.gemfile +18 -0
  35. data/gemfiles/resque_122.gemfile +19 -0
  36. data/gemfiles/resque_20.gemfile +18 -0
  37. data/gemfiles/rest_client_16.gemfile +18 -0
  38. data/gemfiles/rest_client_20.gemfile +18 -0
  39. data/gemfiles/roda_20.gemfile +18 -0
  40. data/gemfiles/roda_30.gemfile +18 -0
  41. data/gemfiles/sidekiq_42.gemfile +18 -0
  42. data/gemfiles/sidekiq_50.gemfile +18 -0
  43. data/gemfiles/sinatra_14.gemfile +18 -0
  44. data/instana.gemspec +5 -7
  45. data/lib/instana.rb +3 -0
  46. data/lib/instana/activator.rb +44 -0
  47. data/lib/instana/activators/action_cable.rb +24 -0
  48. data/lib/instana/activators/action_controller_api.rb +21 -0
  49. data/lib/instana/activators/action_controller_base.rb +21 -0
  50. data/lib/instana/activators/action_view.rb +21 -0
  51. data/lib/instana/activators/active_record.rb +21 -0
  52. data/lib/instana/activators/cuba.rb +21 -0
  53. data/lib/instana/activators/dalli.rb +23 -0
  54. data/lib/instana/activators/excon.rb +20 -0
  55. data/lib/instana/activators/graphql.rb +22 -0
  56. data/lib/instana/activators/grpc_client.rb +20 -0
  57. data/lib/instana/activators/grpc_server.rb +20 -0
  58. data/lib/instana/activators/net_http.rb +20 -0
  59. data/lib/instana/activators/rack.rb +16 -0
  60. data/lib/instana/activators/rails.rb +18 -0
  61. data/lib/instana/activators/redis.rb +20 -0
  62. data/lib/instana/activators/resque_client.rb +21 -0
  63. data/lib/instana/activators/resque_worker.rb +33 -0
  64. data/lib/instana/activators/rest_client.rb +20 -0
  65. data/lib/instana/activators/roda.rb +21 -0
  66. data/lib/instana/activators/sidekiq_client.rb +24 -0
  67. data/lib/instana/activators/sidekiq_worker.rb +24 -0
  68. data/lib/instana/activators/sinatra.rb +21 -0
  69. data/lib/instana/agent.rb +3 -0
  70. data/lib/instana/agent/helpers.rb +3 -0
  71. data/lib/instana/agent/hooks.rb +3 -0
  72. data/lib/instana/agent/tasks.rb +3 -0
  73. data/lib/instana/base.rb +3 -0
  74. data/lib/instana/collector.rb +3 -0
  75. data/lib/instana/collectors/gc.rb +3 -0
  76. data/lib/instana/collectors/memory.rb +3 -0
  77. data/lib/instana/collectors/thread.rb +3 -0
  78. data/lib/instana/config.rb +3 -0
  79. data/lib/instana/frameworks/cuba.rb +9 -13
  80. data/lib/instana/frameworks/rails.rb +22 -32
  81. data/lib/instana/frameworks/roda.rb +10 -13
  82. data/lib/instana/frameworks/sinatra.rb +4 -8
  83. data/lib/instana/helpers.rb +3 -0
  84. data/lib/instana/instrumentation/action_cable.rb +53 -0
  85. data/lib/instana/instrumentation/action_controller.rb +84 -0
  86. data/lib/instana/instrumentation/action_view.rb +30 -0
  87. data/lib/instana/instrumentation/active_record.rb +50 -0
  88. data/lib/instana/instrumentation/dalli.rb +10 -18
  89. data/lib/instana/instrumentation/excon.rb +54 -57
  90. data/lib/instana/instrumentation/graphql.rb +19 -18
  91. data/lib/instana/instrumentation/grpc.rb +73 -66
  92. data/lib/instana/instrumentation/instrumented_request.rb +6 -1
  93. data/lib/instana/instrumentation/net-http.rb +46 -47
  94. data/lib/instana/instrumentation/rack.rb +4 -0
  95. data/lib/instana/instrumentation/redis.rb +13 -18
  96. data/lib/instana/instrumentation/resque.rb +17 -50
  97. data/lib/instana/instrumentation/rest-client.rb +5 -17
  98. data/lib/instana/instrumentation/sidekiq-client.rb +3 -9
  99. data/lib/instana/instrumentation/sidekiq-worker.rb +3 -9
  100. data/lib/instana/opentracing/carrier.rb +3 -0
  101. data/lib/instana/opentracing/tracer.rb +3 -0
  102. data/lib/instana/rack.rb +4 -0
  103. data/lib/instana/secrets.rb +10 -7
  104. data/lib/instana/setup.rb +6 -1
  105. data/lib/instana/thread_local.rb +3 -0
  106. data/lib/instana/tracer.rb +3 -0
  107. data/lib/instana/tracing/processor.rb +3 -0
  108. data/lib/instana/tracing/span.rb +3 -0
  109. data/lib/instana/tracing/span_context.rb +3 -0
  110. data/lib/instana/util.rb +4 -41
  111. data/lib/instana/version.rb +4 -1
  112. data/lib/oj_check.rb +3 -0
  113. data/lib/opentracing.rb +3 -0
  114. data/test/activator_test.rb +30 -0
  115. data/test/agent/agent_test.rb +3 -0
  116. data/test/benchmarks/bench_id_generation.rb +3 -0
  117. data/test/benchmarks/bench_opentracing.rb +3 -0
  118. data/test/config_test.rb +3 -0
  119. data/test/frameworks/cuba_test.rb +41 -40
  120. data/test/frameworks/roda_test.rb +43 -41
  121. data/test/frameworks/sinatra_test.rb +64 -64
  122. data/test/instana_test.rb +3 -0
  123. data/test/instrumentation/dalli_test.rb +3 -0
  124. data/test/instrumentation/excon_test.rb +4 -0
  125. data/test/instrumentation/graphql_test.rb +3 -0
  126. data/test/instrumentation/grpc_test.rb +5 -1
  127. data/test/instrumentation/{net-http_test.rb → net_http_test.rb} +4 -0
  128. data/test/instrumentation/{instrumented_request_test.rb → rack_instrumented_request_test.rb} +4 -1
  129. data/test/{frameworks → instrumentation}/rack_test.rb +3 -1
  130. data/test/instrumentation/rails_action_cable_test.rb +131 -0
  131. data/test/{frameworks/rails/actioncontroller_test.rb → instrumentation/rails_action_controller_test.rb} +40 -21
  132. data/test/instrumentation/rails_action_view_test.rb +151 -0
  133. data/test/instrumentation/rails_active_record_test.rb +122 -0
  134. data/test/instrumentation/redis_test.rb +3 -0
  135. data/test/instrumentation/resque_test.rb +6 -11
  136. data/test/instrumentation/{rest-client_test.rb → rest_client_test.rb} +9 -0
  137. data/test/instrumentation/sidekiq-client_test.rb +4 -0
  138. data/test/instrumentation/sidekiq-worker_test.rb +4 -0
  139. data/test/secrets_test.rb +3 -0
  140. data/test/support/apps/active_record/active_record.rb +24 -0
  141. data/test/{servers/grpc_50051.rb → support/apps/grpc/boot.rb} +4 -1
  142. data/test/{apps → support/apps/grpc}/grpc_server.rb +3 -0
  143. data/test/{servers/rackapp_6511.rb → support/apps/http_endpoint/boot.rb} +3 -0
  144. data/test/{servers/rails_3205.rb → support/apps/rails/boot.rb} +10 -13
  145. data/test/{models → support/apps/rails/models}/block.rb +4 -1
  146. data/test/{models → support/apps/rails/models}/block6.rb +3 -0
  147. data/test/support/apps/resque/boot.rb +5 -0
  148. data/test/{jobs → support/apps/resque/jobs}/resque_error_job.rb +3 -0
  149. data/test/{jobs → support/apps/resque/jobs}/resque_fast_job.rb +3 -0
  150. data/test/support/apps/sidekiq/boot.rb +25 -0
  151. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_1.rb +3 -0
  152. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_2.rb +3 -0
  153. data/test/{servers → support/apps}/sidekiq/worker.rb +5 -2
  154. data/test/support/helpers.rb +97 -0
  155. data/test/test_helper.rb +27 -144
  156. data/test/tracing/custom_test.rb +3 -0
  157. data/test/tracing/id_management_test.rb +4 -0
  158. data/test/tracing/opentracing_test.rb +3 -0
  159. data/test/tracing/tracer_async_test.rb +3 -0
  160. data/test/tracing/tracer_test.rb +3 -0
  161. metadata +105 -96
  162. data/gemfiles/libraries.gemfile +0 -73
  163. data/gemfiles/rails32.gemfile +0 -51
  164. data/gemfiles/rails42.gemfile +0 -50
  165. data/gemfiles/rails50.gemfile +0 -52
  166. data/gemfiles/rails52.gemfile +0 -52
  167. data/gemfiles/rails60.gemfile +0 -72
  168. data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +0 -58
  169. data/lib/instana/frameworks/instrumentation/action_controller.rb +0 -194
  170. data/lib/instana/frameworks/instrumentation/action_view.rb +0 -43
  171. data/lib/instana/frameworks/instrumentation/active_record.rb +0 -27
  172. data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +0 -87
  173. data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +0 -62
  174. data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +0 -103
  175. data/lib/instana/instrumentation.rb +0 -25
  176. data/lib/instana/test.rb +0 -43
  177. data/test/apps/cuba.rb +0 -19
  178. data/test/apps/roda.rb +0 -13
  179. data/test/apps/sinatra.rb +0 -9
  180. data/test/frameworks/rails/actionview3_test.rb +0 -210
  181. data/test/frameworks/rails/actionview4_test.rb +0 -208
  182. data/test/frameworks/rails/actionview5_test.rb +0 -221
  183. data/test/frameworks/rails/activerecord_test.rb +0 -279
  184. data/test/servers/helpers/sidekiq_worker_initializer.rb +0 -27
@@ -1,210 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ActionViewTest < Minitest::Test
4
- def test_config_defaults
5
- assert ::Instana.config[:action_view].is_a?(Hash)
6
- assert ::Instana.config[:action_view].key?(:enabled)
7
- assert_equal true, ::Instana.config[:action_view][:enabled]
8
- end
9
-
10
- def test_render_view
11
- clear_all!
12
-
13
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_view'))
14
-
15
- spans = Instana.processor.queued_spans
16
- assert_equal 3, spans.length
17
- first_span = spans[0]
18
- second_span = spans[1]
19
- third_span = spans[2]
20
-
21
- assert_equal :rack, first_span.name
22
- assert_equal :actioncontroller, second_span.name
23
- assert_equal :actionview, third_span.name
24
- end
25
-
26
- def test_render_nothing
27
- clear_all!
28
-
29
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_nothing'))
30
-
31
- spans = Instana.processor.queued_spans
32
- assert_equal 3, spans.length
33
- first_span = spans[0]
34
- second_span = spans[1]
35
- third_span = spans[2]
36
-
37
- assert_equal :rack, first_span.name
38
- assert_equal :actioncontroller, second_span.name
39
- assert_equal "Nothing", third_span[:data][:actionview][:name]
40
- assert_equal :actionview, third_span.name
41
- end
42
-
43
- def test_render_file
44
- clear_all!
45
-
46
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_file'))
47
-
48
- spans = Instana.processor.queued_spans
49
- assert_equal 3, spans.length
50
- first_span = spans[0]
51
- second_span = spans[1]
52
- third_span = spans[2]
53
-
54
- assert_equal :rack, first_span.name
55
- assert_equal :actioncontroller, second_span.name
56
- assert_equal "/etc/issue", third_span[:data][:actionview][:name]
57
- assert_equal :actionview, third_span.name
58
- end
59
-
60
- def test_render_json
61
- clear_all!
62
-
63
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_json'))
64
-
65
- spans = Instana.processor.queued_spans
66
- assert_equal 3, spans.length
67
- first_span = spans[0]
68
- second_span = spans[1]
69
- third_span = spans[2]
70
-
71
- assert_equal :rack, first_span.name
72
- assert_equal :actioncontroller, second_span.name
73
- assert_equal "JSON", third_span[:data][:actionview][:name]
74
- assert_equal :actionview, third_span.name
75
- end
76
-
77
- def test_render_xml
78
- clear_all!
79
-
80
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_xml'))
81
-
82
- assert_equal 3, spans.length
83
- first_span = spans[0]
84
- second_span = spans[1]
85
- third_span = spans[2]
86
-
87
- assert_equal :rack, first_span.name
88
- assert_equal :actioncontroller, second_span.name
89
- assert_equal "XML", third_span[:data][:actionview][:name]
90
- assert_equal :actionview, third_span.name
91
- end
92
-
93
- def test_render_body
94
- clear_all!
95
-
96
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_rawbody'))
97
-
98
- spans = Instana.processor.queued_spans
99
- assert_equal 3, spans.length
100
- first_span = spans[0]
101
- second_span = spans[1]
102
- third_span = spans[2]
103
-
104
- assert_equal :rack, first_span.name
105
- assert_equal :actioncontroller, second_span.name
106
- assert_equal "Raw", third_span[:data][:actionview][:name]
107
- assert_equal :actionview, third_span.name
108
- end
109
-
110
- def test_render_js
111
- clear_all!
112
-
113
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_js'))
114
-
115
- spans = Instana.processor.queued_spans
116
- assert_equal 3, spans.length
117
- first_span = spans[0]
118
- second_span = spans[1]
119
- third_span = spans[2]
120
-
121
- assert_equal :rack, first_span.name
122
- assert_equal :actioncontroller, second_span.name
123
- assert_equal "Javascript", third_span[:data][:actionview][:name]
124
- assert_equal :actionview, third_span.name
125
- end
126
-
127
- def test_render_alternate_layout
128
- clear_all!
129
-
130
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_alternate_layout'))
131
-
132
- spans = Instana.processor.queued_spans
133
- assert_equal 3, spans.length
134
- first_span = spans[0]
135
- second_span = spans[1]
136
- third_span = spans[2]
137
-
138
- assert_equal :rack, first_span.name
139
- assert_equal :actioncontroller, second_span.name
140
- assert_equal "layouts/mobile", third_span[:data][:actionview][:name]
141
- assert_equal :actionview, third_span.name
142
- end
143
-
144
- def test_render_partial
145
- clear_all!
146
-
147
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial'))
148
-
149
- spans = Instana.processor.queued_spans
150
- assert_equal 4, spans.length
151
- first_span = spans[0]
152
- second_span = spans[1]
153
- third_span = spans[2]
154
- fourth_span = spans[3]
155
-
156
- assert_equal :rack, first_span.name
157
- assert_equal :actioncontroller, second_span.name
158
- assert_equal :actionview, third_span.name
159
- assert_equal :render, fourth_span.name
160
- assert_equal :partial, fourth_span[:data][:render][:type]
161
- assert_equal 'message', fourth_span[:data][:render][:name]
162
- end
163
-
164
- def test_render_partial_that_errors
165
- clear_all!
166
-
167
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial_that_errors'))
168
-
169
- spans = Instana.processor.queued_spans
170
- assert_equal 4, spans.length
171
- first_span = spans[0]
172
- second_span = spans[1]
173
- third_span = spans[2]
174
- fourth_span = spans[3]
175
-
176
- assert_equal :rack, first_span.name
177
- assert_equal :actioncontroller, second_span.name
178
- assert_equal :actionview, third_span.name
179
- assert_equal :render, fourth_span.name
180
- assert_equal :partial, fourth_span[:data][:render][:type]
181
- assert_equal 'syntax_error', fourth_span[:data][:render][:name]
182
- assert fourth_span[:data][:log].key?(:message)
183
- assert_equal "ActionView::Template::Error", fourth_span[:data][:log][:parameters]
184
- assert fourth_span[:error]
185
- assert fourth_span[:stack]
186
- end
187
-
188
- def test_render_collection
189
- clear_all!
190
-
191
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_collection'))
192
-
193
- spans = Instana.processor.queued_spans
194
- assert_equal 5, spans.length
195
- first_span = spans[0]
196
- second_span = spans[1]
197
- third_span = spans[2]
198
- fourth_span = spans[3]
199
- fifth_span = spans[4]
200
-
201
- assert_equal :rack, first_span.name
202
- assert_equal :actioncontroller, second_span.name
203
- assert_equal :activerecord, third_span.name
204
- assert_equal :actionview, fourth_span.name
205
-
206
- assert_equal :render, fifth_span.name
207
- assert_equal :collection, fifth_span[:data][:render][:type]
208
- assert_equal 'blocks/block', fifth_span[:data][:render][:name]
209
- end
210
- end
@@ -1,208 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ActionViewTest < Minitest::Test
4
- def test_config_defaults
5
- assert ::Instana.config[:action_view].is_a?(Hash)
6
- assert ::Instana.config[:action_view].key?(:enabled)
7
- assert_equal true, ::Instana.config[:action_view][:enabled]
8
- end
9
-
10
- def test_render_view
11
- clear_all!
12
-
13
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_view'))
14
-
15
- spans = Instana.processor.queued_spans
16
- assert_equal 3, spans.length
17
- rack_span = find_first_span_by_name(spans, :rack)
18
- ac_span = find_first_span_by_name(spans, :actioncontroller)
19
- av_span = find_first_span_by_name(spans, :actionview)
20
-
21
- assert_equal :rack, rack_span[:n]
22
- assert_equal :actioncontroller, ac_span[:n]
23
- assert_equal :actionview, av_span[:n]
24
- end
25
-
26
- def test_render_nothing
27
- clear_all!
28
-
29
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_nothing'))
30
-
31
- spans = Instana.processor.queued_spans
32
- assert_equal 3, spans.length
33
- rack_span = find_first_span_by_name(spans, :rack)
34
- ac_span = find_first_span_by_name(spans, :actioncontroller)
35
- av_span = find_first_span_by_name(spans, :actionview)
36
-
37
- assert_equal :rack, rack_span[:n]
38
- assert_equal :actioncontroller, ac_span[:n]
39
- assert_equal "Nothing", av_span[:data][:actionview][:name]
40
- assert_equal :actionview, av_span[:n]
41
- end
42
-
43
- def test_render_file
44
- clear_all!
45
-
46
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_file'))
47
-
48
- spans = Instana.processor.queued_spans
49
- assert_equal 3, spans.length
50
- rack_span = find_first_span_by_name(spans, :rack)
51
- ac_span = find_first_span_by_name(spans, :actioncontroller)
52
- av_span = find_first_span_by_name(spans, :actionview)
53
-
54
- assert_equal :rack, rack_span[:n]
55
- assert_equal :actioncontroller, ac_span[:n]
56
- assert_equal "/etc/issue", av_span[:data][:actionview][:name]
57
- assert_equal :actionview, av_span[:n]
58
- end
59
-
60
- def test_render_json
61
- clear_all!
62
-
63
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_json'))
64
-
65
- spans = Instana.processor.queued_spans
66
- assert_equal 3, spans.length
67
- rack_span = find_first_span_by_name(spans, :rack)
68
- ac_span = find_first_span_by_name(spans, :actioncontroller)
69
- av_span = find_first_span_by_name(spans, :actionview)
70
-
71
- assert_equal :rack, rack_span[:n]
72
- assert_equal :actioncontroller, ac_span[:n]
73
- assert_equal "JSON", av_span[:data][:actionview][:name]
74
- assert_equal :actionview, av_span[:n]
75
- end
76
-
77
- def test_render_xml
78
- clear_all!
79
-
80
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_xml'))
81
-
82
- spans = Instana.processor.queued_spans
83
- assert_equal 3, spans.length
84
- rack_span = find_first_span_by_name(spans, :rack)
85
- ac_span = find_first_span_by_name(spans, :actioncontroller)
86
- av_span = find_first_span_by_name(spans, :actionview)
87
-
88
- assert_equal :rack, rack_span[:n]
89
- assert_equal :actioncontroller, ac_span[:n]
90
- assert_equal "XML", av_span[:data][:actionview][:name]
91
- assert_equal :actionview, av_span[:n]
92
- end
93
-
94
- def test_render_body
95
- clear_all!
96
-
97
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_rawbody'))
98
-
99
- spans = Instana.processor.queued_spans
100
- assert_equal 3, spans.length
101
- rack_span = find_first_span_by_name(spans, :rack)
102
- ac_span = find_first_span_by_name(spans, :actioncontroller)
103
- av_span = find_first_span_by_name(spans, :actionview)
104
-
105
- assert_equal :rack, rack_span[:n]
106
- assert_equal :actioncontroller, ac_span[:n]
107
- assert_equal "Raw", av_span[:data][:actionview][:name]
108
- assert_equal :actionview, av_span[:n]
109
- end
110
-
111
- def test_render_js
112
- clear_all!
113
-
114
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_js'))
115
-
116
- spans = Instana.processor.queued_spans
117
- assert_equal 3, spans.length
118
- rack_span = find_first_span_by_name(spans, :rack)
119
- ac_span = find_first_span_by_name(spans, :actioncontroller)
120
- av_span = find_first_span_by_name(spans, :actionview)
121
-
122
- assert_equal :rack, rack_span[:n]
123
- assert_equal :actioncontroller, ac_span[:n]
124
- assert_equal "Javascript", av_span[:data][:actionview][:name]
125
- assert_equal :actionview, av_span[:n]
126
- end
127
-
128
- def test_render_alternate_layout
129
- clear_all!
130
-
131
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_alternate_layout'))
132
-
133
- spans = Instana.processor.queued_spans
134
- assert_equal 3, spans.length
135
- rack_span = find_first_span_by_name(spans, :rack)
136
- ac_span = find_first_span_by_name(spans, :actioncontroller)
137
- av_span = find_first_span_by_name(spans, :actionview)
138
-
139
- assert_equal :rack, rack_span[:n]
140
- assert_equal :actioncontroller, ac_span[:n]
141
- assert_equal "layouts/mobile", av_span[:data][:actionview][:name]
142
- assert_equal :actionview, av_span[:n]
143
- end
144
-
145
- def test_render_partial
146
- clear_all!
147
-
148
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial'))
149
-
150
- spans = Instana.processor.queued_spans
151
- assert_equal 4, spans.length
152
- rack_span = find_first_span_by_name(spans, :rack)
153
- ac_span = find_first_span_by_name(spans, :actioncontroller)
154
- av_span = find_first_span_by_name(spans, :actionview)
155
- render_span = find_first_span_by_name(spans, :render)
156
-
157
- assert_equal :rack, rack_span[:n]
158
- assert_equal :actioncontroller, ac_span[:n]
159
- assert_equal :partial, render_span[:data][:render][:type]
160
- assert_equal 'message', render_span[:data][:render][:name]
161
- end
162
-
163
- def test_render_partial_that_errors
164
- clear_all!
165
-
166
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial_that_errors'))
167
-
168
- spans = Instana.processor.queued_spans
169
- assert_equal 4, spans.length
170
- rack_span = find_first_span_by_name(spans, :rack)
171
- ac_span = find_first_span_by_name(spans, :actioncontroller)
172
- av_span = find_first_span_by_name(spans, :actionview)
173
- render_span = find_first_span_by_name(spans, :render)
174
-
175
- assert_equal :rack, rack_span[:n]
176
- assert_equal :actioncontroller, ac_span[:n]
177
- assert_equal :actionview, av_span[:n]
178
- assert_equal :render, render_span[:n]
179
- assert_equal :partial, render_span[:data][:render][:type]
180
- assert_equal 'syntax_error', render_span[:data][:render][:name]
181
- assert render_span[:data][:log].key?(:message)
182
- assert_equal "SyntaxError", render_span[:data][:log][:parameters]
183
- assert render_span[:error]
184
- assert render_span[:stack]
185
- end
186
-
187
- def test_render_collection
188
- clear_all!
189
-
190
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_collection'))
191
-
192
- spans = Instana.processor.queued_spans
193
- assert_equal 5, spans.length
194
- rack_span = find_first_span_by_name(spans, :rack)
195
- ac_span = find_first_span_by_name(spans, :actioncontroller)
196
- av_span = find_first_span_by_name(spans, :actionview)
197
- ar_span = find_first_span_by_name(spans, :activerecord)
198
- render_span = find_first_span_by_name(spans, :render)
199
-
200
- assert_equal :rack, rack_span[:n]
201
- assert_equal :actioncontroller, ac_span[:n]
202
- assert_equal :actionview, av_span[:n]
203
- assert_equal :activerecord, ar_span[:n]
204
- assert_equal :render, render_span[:n]
205
- assert_equal :collection, render_span[:data][:render][:type]
206
- assert_equal 'blocks/block', render_span[:data][:render][:name]
207
- end
208
- end
@@ -1,221 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ActionViewTest < Minitest::Test
4
- def test_config_defaults
5
- assert ::Instana.config[:action_view].is_a?(Hash)
6
- assert ::Instana.config[:action_view].key?(:enabled)
7
- assert_equal true, ::Instana.config[:action_view][:enabled]
8
- end
9
-
10
- def test_render_view
11
- clear_all!
12
-
13
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_view'))
14
-
15
- spans = ::Instana.processor.queued_spans
16
- assert_equal 3, spans.length
17
-
18
- first_span = spans[2]
19
- second_span = spans[1]
20
- third_span = spans[0]
21
-
22
- assert_equal :rack, first_span[:n]
23
- assert_equal :actioncontroller, second_span[:n]
24
- assert_equal :actionview, third_span[:n]
25
- end
26
-
27
- def test_render_nothing
28
- clear_all!
29
-
30
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_nothing'))
31
-
32
- spans = ::Instana.processor.queued_spans
33
- assert_equal 3, spans.length
34
-
35
- first_span = spans[2]
36
- second_span = spans[1]
37
- third_span = spans[0]
38
-
39
- assert_equal :rack, first_span[:n]
40
- assert_equal :actioncontroller, second_span[:n]
41
- assert_equal "Nothing", third_span[:data][:actionview][:name]
42
- assert_equal :actionview, third_span[:n]
43
- end
44
-
45
- def test_render_file
46
- clear_all!
47
-
48
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_file'))
49
-
50
- spans = ::Instana.processor.queued_spans
51
- assert_equal 3, spans.length
52
-
53
- first_span = spans[2]
54
- second_span = spans[1]
55
- third_span = spans[0]
56
-
57
- assert_equal :rack, first_span[:n]
58
- assert_equal :actioncontroller, second_span[:n]
59
- assert_equal "/etc/issue", third_span[:data][:actionview][:name]
60
- assert_equal :actionview, third_span[:n]
61
- end
62
-
63
- def test_render_json
64
- clear_all!
65
-
66
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_json'))
67
-
68
- spans = ::Instana.processor.queued_spans
69
- assert_equal 3, spans.length
70
-
71
- first_span = spans[2]
72
- second_span = spans[1]
73
- third_span = spans[0]
74
-
75
- assert_equal :rack, first_span[:n]
76
- assert_equal :actioncontroller, second_span[:n]
77
- assert_equal "JSON", third_span[:data][:actionview][:name]
78
- assert_equal :actionview, third_span[:n]
79
- end
80
-
81
- def test_render_xml
82
- clear_all!
83
-
84
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_xml'))
85
-
86
- spans = ::Instana.processor.queued_spans
87
- assert_equal 3, spans.length
88
-
89
- first_span = spans[2]
90
- second_span = spans[1]
91
- third_span = spans[0]
92
-
93
- assert_equal :rack, first_span[:n]
94
- assert_equal :actioncontroller, second_span[:n]
95
- assert_equal "XML", third_span[:data][:actionview][:name]
96
- assert_equal :actionview, third_span[:n]
97
- end
98
-
99
- def test_render_body
100
- clear_all!
101
-
102
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_rawbody'))
103
-
104
- spans = ::Instana.processor.queued_spans
105
- assert_equal 3, spans.length
106
-
107
- rack_span = find_first_span_by_name(spans, :rack)
108
- ac_span = find_first_span_by_name(spans, :actioncontroller)
109
- av_span = find_first_span_by_name(spans, :actionview)
110
-
111
- assert_equal :actioncontroller, ac_span[:n]
112
- assert_equal "Raw", av_span[:data][:actionview][:name]
113
- assert_equal :actionview, av_span[:n]
114
- end
115
-
116
- def test_render_js
117
- clear_all!
118
-
119
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_js'))
120
-
121
- spans = ::Instana.processor.queued_spans
122
- assert_equal 3, spans.length
123
-
124
- first_span = spans[2]
125
- second_span = spans[1]
126
- third_span = spans[0]
127
-
128
- assert_equal :rack, first_span[:n]
129
- assert_equal :actioncontroller, second_span[:n]
130
- assert_equal "Javascript", third_span[:data][:actionview][:name]
131
- assert_equal :actionview, third_span[:n]
132
- end
133
-
134
- def test_render_alternate_layout
135
- clear_all!
136
-
137
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_alternate_layout'))
138
-
139
- spans = ::Instana.processor.queued_spans
140
- assert_equal 3, spans.length
141
-
142
- first_span = spans[2]
143
- second_span = spans[1]
144
- third_span = spans[0]
145
-
146
- assert_equal :rack, first_span[:n]
147
- assert_equal :actioncontroller, second_span[:n]
148
- assert_equal "layouts/mobile", third_span[:data][:actionview][:name]
149
- assert_equal :actionview, third_span[:n]
150
- end
151
-
152
- def test_render_partial
153
- clear_all!
154
-
155
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial'))
156
-
157
- spans = ::Instana.processor.queued_spans
158
- assert_equal 4, spans.length
159
-
160
- first_span = spans[3]
161
- second_span = spans[2]
162
- third_span = spans[1]
163
- fourth_span = spans[0]
164
-
165
- assert_equal :rack, first_span[:n]
166
- assert_equal :actioncontroller, second_span[:n]
167
- assert_equal :actionview, third_span[:n]
168
- assert_equal :render, fourth_span[:n]
169
- assert_equal :partial, fourth_span[:data][:render][:type]
170
- assert_equal 'message', fourth_span[:data][:render][:name]
171
- end
172
-
173
- def test_render_partial_that_errors
174
- clear_all!
175
-
176
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial_that_errors'))
177
-
178
- spans = ::Instana.processor.queued_spans
179
- assert_equal 4, spans.length
180
-
181
- first_span = spans[3]
182
- second_span = spans[2]
183
- third_span = spans[1]
184
- fourth_span = spans[0]
185
-
186
- assert_equal :rack, first_span[:n]
187
- assert_equal :actioncontroller, second_span[:n]
188
- assert_equal :actionview, third_span[:n]
189
- assert_equal :render, fourth_span[:n]
190
- assert_equal :partial, fourth_span[:data][:render][:type]
191
- assert_equal 'syntax_error', fourth_span[:data][:render][:name]
192
- assert fourth_span[:data][:log].key?(:message)
193
- assert(fourth_span[:data][:log][:parameters].include?("SyntaxError"))
194
- assert fourth_span[:error]
195
- assert fourth_span[:stack]
196
- end
197
-
198
- def test_render_collection
199
- clear_all!
200
-
201
- Net::HTTP.get(URI.parse('http://localhost:3205/test/render_collection'))
202
-
203
- spans = ::Instana.processor.queued_spans
204
- assert_equal 5, spans.length
205
-
206
- rack_span = find_first_span_by_name(spans, :rack)
207
- ac_span = find_first_span_by_name(spans, :actioncontroller)
208
- ar_span = find_first_span_by_name(spans, :activerecord)
209
- av_span = find_first_span_by_name(spans, :actionview)
210
- render_span = find_first_span_by_name(spans, :render)
211
-
212
- assert_equal render_span[:p], av_span[:s]
213
- assert_equal av_span[:p], ac_span[:s]
214
- assert_equal ar_span[:p], av_span[:s]
215
- assert_equal ac_span[:p], rack_span[:s]
216
-
217
- assert_equal :render, render_span[:n]
218
- assert_equal :collection, render_span[:data][:render][:type]
219
- assert_equal 'blocks/block', render_span[:data][:render][:name]
220
- end
221
- end