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,279 +0,0 @@
1
- require 'test_helper'
2
- require 'active_record'
3
-
4
- class ActiveRecordTest < Minitest::Test
5
-
6
- def teardown
7
- # Make sure defaults are back in place
8
- ::Instana.config[:sanitize_sql] = true
9
- end
10
-
11
- def test_config_defaults
12
- assert ::Instana.config[:sanitize_sql] == true
13
- assert ::Instana.config[:active_record].is_a?(Hash)
14
- assert ::Instana.config[:active_record].key?(:enabled)
15
- assert_equal true, ::Instana.config[:active_record][:enabled]
16
- end
17
-
18
- def test_postgresql
19
- skip unless ::Instana::Test.postgresql?
20
-
21
- clear_all!
22
-
23
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
24
-
25
- spans = Instana.processor.queued_spans
26
- assert_equal 6, spans.length
27
- rack_span = find_first_span_by_name(spans, :rack)
28
-
29
- ar_spans = find_spans_by_name(spans, :activerecord)
30
- assert_equal 3, ar_spans.length
31
-
32
- ar_spans.each do |span|
33
- assert_equal "postgresql", span[:data][:activerecord][:adapter]
34
- assert span[:data][:activerecord].key?(:host)
35
- assert span[:data][:activerecord].key?(:username)
36
- end
37
-
38
- if ::Rails::VERSION::MAJOR < 4
39
- sql = "INSERT INTO \"blocks\" (\"color\", \"created_at\", \"name\", \"updated_at\") VALUES ($?, $?, $?, $?) RETURNING \"id\""
40
- else
41
- sql = "INSERT INTO \"blocks\" (\"name\", \"color\", \"created_at\", \"updated_at\") VALUES ($?, $?, $?, $?) RETURNING \"id\""
42
- end
43
- ar_span = find_first_span_by_qualifier(ar_spans) do |span|
44
- span[:data][:activerecord][:sql] == sql
45
- end
46
-
47
- found = false
48
- if ::Rails::VERSION::MAJOR >= 5
49
- sql = "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = $? ORDER BY \"blocks\".\"id\" ASC LIMIT $?"
50
- elsif ::Rails::VERSION::MAJOR == 4
51
- sql = "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = $? ORDER BY \"blocks\".\"id\" ASC LIMIT ?"
52
- else
53
- sql = "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = ? LIMIT ?"
54
- end
55
- ar_span = find_first_span_by_qualifier(ar_spans) do |span|
56
- span[:data][:activerecord][:sql] == sql
57
- end
58
-
59
- found = false
60
- if ::Rails::VERSION::MAJOR == 3
61
- sql = "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = ?"
62
- else
63
- sql = "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = $?"
64
- end
65
- ar_span = find_first_span_by_qualifier(ar_spans) do |span|
66
- span[:data][:activerecord][:sql] == sql
67
- end
68
- end
69
-
70
- def test_postgresql_without_sanitize
71
- skip unless ::Instana::Test.postgresql?
72
-
73
- # Shut SQL sanitization off
74
- ::Instana.config[:sanitize_sql] = false
75
- # Pause so the thread can syncronize values
76
- sleep 1
77
-
78
- clear_all!
79
-
80
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
81
-
82
- spans = Instana.processor.queued_spans
83
- assert_equal 6, spans.length
84
- rack_span = find_first_span_by_name(spans, :rack)
85
-
86
- ar_spans = find_spans_by_name(spans, :activerecord)
87
- assert_equal 3, ar_spans.length
88
-
89
- ar_spans.each do |span|
90
- assert_equal "postgresql", span[:data][:activerecord][:adapter]
91
- assert span[:data][:activerecord].key?(:host)
92
- assert span[:data][:activerecord].key?(:username)
93
- end
94
-
95
- if ::Rails::VERSION::MAJOR < 4
96
- sql = "INSERT INTO \"blocks\" (\"color\", \"created_at\", \"name\", \"updated_at\") VALUES ($1, $2, $3, $4) RETURNING \"id\""
97
- else
98
- sql = "INSERT INTO \"blocks\" (\"name\", \"color\", \"created_at\", \"updated_at\") VALUES ($1, $2, $3, $4) RETURNING \"id\""
99
- end
100
- ar_span = find_first_span_by_qualifier(ar_spans) do |span|
101
- span[:data][:activerecord][:sql] == sql
102
- end
103
- assert ar_span[:data][:activerecord].key?(:binds)
104
- assert ar_span[:data][:activerecord][:binds].is_a?(Array)
105
- assert_equal 4, ar_span[:data][:activerecord][:binds].length
106
-
107
- if ::Rails::VERSION::MAJOR >= 5
108
- sql = "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = $1 ORDER BY \"blocks\".\"id\" ASC LIMIT $2"
109
- elsif ::Rails::VERSION::MAJOR == 4
110
- sql = "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = $? ORDER BY \"blocks\".\"id\" ASC LIMIT ?"
111
- else
112
- sql = "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = ? LIMIT ?"
113
- end
114
- ar_span = find_first_span_by_qualifier(ar_spans) do |span|
115
- span[:data][:activerecord][:sql] == sql
116
- end
117
- assert ar_span[:data][:activerecord].key?(:binds)
118
- assert ar_span[:data][:activerecord][:binds].is_a?(Array)
119
- assert_equal 2, ar_span[:data][:activerecord][:binds].length
120
-
121
- if ::Rails::VERSION::MAJOR == 3
122
- sql = "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = 1"
123
- else
124
- sql = "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = $1"
125
- end
126
- ar_span = find_first_span_by_qualifier(ar_spans) do |span|
127
- span[:data][:activerecord][:sql] == sql
128
- end
129
- assert ar_span[:data][:activerecord].key?(:binds)
130
- assert ar_span[:data][:activerecord][:binds].is_a?(Array)
131
- assert_equal 1, ar_span[:data][:activerecord][:binds].length
132
- end
133
-
134
- def test_postgresql_lock_table
135
- skip unless ::Instana::Test.postgresql?
136
-
137
- clear_all!
138
-
139
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db_lock_table'))
140
-
141
- spans = Instana.processor.queued_spans
142
- assert_equal 5, spans.length
143
-
144
- rack_span = find_first_span_by_name(spans, :rack)
145
- ac_span = find_first_span_by_name(spans, :actioncontroller)
146
- av_span = find_first_span_by_name(spans, :actionview)
147
-
148
- ar_spans = find_spans_by_name(spans, :activerecord)
149
- assert_equal 2, ar_spans.length
150
-
151
- ar_spans.each do |ar_span|
152
- assert_equal "postgresql", ar_span[:data][:activerecord][:adapter]
153
- assert_equal "postgres", ar_span[:data][:activerecord][:username]
154
- end
155
-
156
- ar_span = find_first_span_by_qualifier(ar_spans) do |span|
157
- span[:data][:activerecord][:sql] == "LOCK blocks IN ACCESS EXCLUSIVE MODE"
158
- end
159
-
160
- ar_span = find_first_span_by_qualifier(ar_spans) do |span|
161
- span[:data][:activerecord][:sql] == "SELECT ?"
162
- end
163
- end
164
-
165
- def test_postgresql_raw_execute
166
- skip unless ::Instana::Test.postgresql?
167
-
168
- clear_all!
169
-
170
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db_raw_execute'))
171
-
172
- spans = Instana.processor.queued_spans
173
-
174
- assert_equal 4, spans.length
175
- rack_span = find_first_span_by_name(spans, :rack)
176
- ac_span = find_first_span_by_name(spans, :actioncontroller)
177
- av_span = find_first_span_by_name(spans, :actionview)
178
- ar_span = find_first_span_by_name(spans, :activerecord)
179
-
180
- assert_equal "SELECT ?", ar_span[:data][:activerecord][:sql]
181
- assert_equal "postgresql", ar_span[:data][:activerecord][:adapter]
182
- assert_equal "postgres", ar_span[:data][:activerecord][:username]
183
- end
184
-
185
- def test_postgresql_raw_execute_error
186
- skip unless ::Instana::Test.postgresql?
187
-
188
- clear_all!
189
-
190
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db_raw_execute_error'))
191
-
192
- spans = Instana.processor.queued_spans
193
-
194
- assert_equal 3, spans.length
195
- rack_span = find_first_span_by_name(spans, :rack)
196
- ac_span = find_first_span_by_name(spans, :actioncontroller)
197
- ar_span = find_first_span_by_name(spans, :activerecord)
198
-
199
- assert ar_span.key?(:stack)
200
- assert ar_span[:data][:activerecord].key?(:error)
201
- assert ar_span[:data][:activerecord][:error].include?("syntax error")
202
- assert_equal "This is not real SQL but an intended error", ar_span[:data][:activerecord][:sql]
203
- assert_equal "postgresql", ar_span[:data][:activerecord][:adapter]
204
- assert_equal "postgres", ar_span[:data][:activerecord][:username]
205
- end
206
-
207
- def test_mysql2
208
- skip unless ::Instana::Test.mysql2?
209
-
210
- clear_all!
211
-
212
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
213
-
214
- spans = Instana.processor.queued_spans
215
- assert_equal 6, spans.length
216
- rack_span = find_first_span_by_name(spans, :rack)
217
-
218
- ar_spans = find_spans_by_name(spans, :activerecord)
219
- assert_equal 3, ar_spans.length
220
-
221
- ar_spans.each do |span|
222
- assert_equal "mysql2", span[:data][:activerecord][:adapter]
223
- assert span[:data][:activerecord].key?(:host)
224
- assert span[:data][:activerecord].key?(:username)
225
- end
226
-
227
- queries = [
228
- "INSERT INTO `blocks` (`name`, `color`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)",
229
- "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? ORDER BY `blocks`.`id` ASC LIMIT ?",
230
- "DELETE FROM `blocks` WHERE `blocks`.`id` = ?"
231
- ]
232
-
233
- queries.each do |sql|
234
- found = false
235
- ar_spans.each do |span|
236
- if span[:data][:activerecord][:sql] = sql
237
- found = true
238
- end
239
- end
240
- assert found
241
- end
242
- end
243
-
244
- def test_mysql
245
- skip unless ::Instana::Test.mysql?
246
-
247
- clear_all!
248
-
249
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
250
-
251
- spans = Instana.processor.queued_spans
252
- assert_equal 6, spans.length
253
- first_span = spans[0]
254
- second_span = spans[2]
255
- third_span = spans[3]
256
- fourth_span = spans[4]
257
-
258
- assert_equal :rack, first_span[:n]
259
- assert_equal :activerecord, second_span[:n]
260
- assert_equal :activerecord, third_span[:n]
261
- assert_equal :activerecord, fourth_span[:n]
262
-
263
- assert_equal "INSERT INTO `blocks` (`name`, `color`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
264
- assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? ORDER BY `blocks`.`id` ASC LIMIT ?", third_span[:data][:activerecord][:sql]
265
- assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
266
-
267
- assert_equal "mysql", second_span[:data][:activerecord][:adapter]
268
- assert_equal "mysql", third_span[:data][:activerecord][:adapter]
269
- assert_equal "mysql", fourth_span[:data][:activerecord][:adapter]
270
-
271
- assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
272
- assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
273
- assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
274
-
275
- assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
276
- assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
277
- assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
278
- end
279
- end
@@ -1,27 +0,0 @@
1
- # This is a helper initializer to boot a local instrumented Sidekiq stack
2
- # for development and testing.
3
- #
4
- # export BUNDLE_GEMFILE=/path/to/ruby-sensor/gemfiles/libraries.gemfile
5
- # bundle install
6
- # bundle exec sidekiq -c 2 -q important -r ./test/servers/helpers/sidekiq_worker_initializer.rb
7
- #
8
- # In another shell, you can boot a console to queue jobs:
9
- #
10
- # export BUNDLE_GEMFILE=/path/to/ruby-sensor/gemfiles/libraries.gemfile
11
- # bundle install
12
- # bundle exec rake console
13
- # > require Dir.pwd + '/test/jobs/sidekiq_job_1.rb'
14
- # > Instana.tracer.start_or_continue_trace(:sidekiq_demo) do
15
- # > ::Sidekiq::Client.push( 'queue' => 'important', 'class' => ::SidekiqJobOne,
16
- # > 'args' => [1, 2, 3], 'retry' => false)
17
- # > end
18
- #
19
-
20
- # Load test jobs.
21
- require Dir.pwd + '/test/jobs/sidekiq_job_1.rb'
22
- require Dir.pwd + '/test/jobs/sidekiq_job_2.rb'
23
-
24
- require "sidekiq"
25
- require "instana"
26
- ::Instana.logger.info "Booting instrumented sidekiq worker for tests."
27
- ::Sidekiq.logger.level = ::Logger::DEBUG