traceview 3.2.1-java → 3.3.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,29 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ class DBWorkerJob
5
+ include Sidekiq::Worker
6
+
7
+ def perform(*args)
8
+ return unless defined?(::Sequel) && !defined?(JRUBY_VERSION)
9
+
10
+ if ENV.key?('TRAVIS_MYSQL_PASS')
11
+ @db = Sequel.connect("mysql2://root:#{ENV['TRAVIS_MYSQL_PASS']}@127.0.0.1:3306/travis_ci_test")
12
+ else
13
+ @db = Sequel.connect('mysql2://root@127.0.0.1:3306/travis_ci_test')
14
+ end
15
+
16
+ unless @db.table_exists?(:items)
17
+ @db.create_table :items do
18
+ primary_key :id
19
+ String :name
20
+ Float :price
21
+ end
22
+ end
23
+
24
+ @db.run('select 1')
25
+
26
+ items = @db[:items]
27
+ items.count
28
+ end
29
+ end
@@ -0,0 +1,10 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ class ErrorWorkerJob
5
+ include Sidekiq::Worker
6
+
7
+ def perform(*args)
8
+ raise "This is a worker error yeah!"
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ class RemoteCallWorkerJob
5
+ include Sidekiq::Worker
6
+
7
+ def perform(*args)
8
+ # Make some random Dalli (memcache) calls and top it
9
+ # off with an excon call to the background rack webserver.
10
+ @dc = Dalli::Client.new
11
+ @dc.get(rand(10).to_s)
12
+ uri = URI('http://gameface.in/gamers')
13
+ http = Net::HTTP.new(uri.host, uri.port)
14
+ request = Net::HTTP::Get.new(uri.request_uri)
15
+ http.request(request)
16
+ @dc.get(rand(10).to_s)
17
+ @dc.get(rand(10).to_s)
18
+ @dc.get_multi([:one, :two, :three, :four, :five, :six])
19
+ end
20
+ end
@@ -61,6 +61,10 @@ when /rails3/
61
61
  require "./test/servers/rails3x_8140"
62
62
  when /frameworks/
63
63
  when /libraries/
64
+ if RUBY_VERSION >= '2.0'
65
+ # Background Sidekiq thread
66
+ require './test/servers/sidekiq.rb'
67
+ end
64
68
  end
65
69
 
66
70
  ##
@@ -143,7 +147,6 @@ def valid_edges?(traces)
143
147
  traces.reverse.each do |t|
144
148
  if t.key?("Edge")
145
149
  unless has_edge?(t["Edge"], traces)
146
- require 'byebug'; debugger
147
150
  return false
148
151
  end
149
152
  end
@@ -0,0 +1,14 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ require 'minitest_helper'
5
+
6
+ class TVReporterTest < Minitest::Test
7
+ def reporter_has_start_method
8
+ assert_equal true, TV::Reporter.respond_to?(:start), "has restart method"
9
+ end
10
+
11
+ def reporter_has_restart_method
12
+ assert_equal true, TV::Reporter.respond_to?(:restart), "has start method"
13
+ end
14
+ end
@@ -0,0 +1,35 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ require 'sidekiq/cli'
5
+
6
+ TraceView.logger.info "[traceview/servers] Starting up background Sidekiq."
7
+
8
+ options = []
9
+ arguments = ""
10
+ options << ["-r", Dir.pwd + "/test/servers/sidekiq_initializer.rb"]
11
+ options << ["-q", "critical,20", "-q", "default"]
12
+ options << ["-c", "10"]
13
+ options << ["-P", "/tmp/sidekiq_#{Process.pid}.pid"]
14
+
15
+ options.flatten.each do |x|
16
+ arguments += " #{x}"
17
+ end
18
+
19
+ TraceView.logger.debug "[traceview/servers] sidekiq #{arguments}"
20
+
21
+ # Boot Sidekiq in a new thread
22
+ Thread.new do
23
+ system("OBOE_GEM_TEST=true sidekiq #{arguments}")
24
+ end
25
+
26
+ # Allow Sidekiq to boot up
27
+ sleep 10
28
+
29
+ # Add a hook to shutdown sidekiq after Minitest finished running
30
+ Minitest.after_run {
31
+ TraceView.logger.warn "[traceview/servers] Shutting down Sidekiq."
32
+ pid = File.read("/tmp/sidekiq_#{Process.pid}.pid").chomp
33
+ Process.kill(:TERM, pid.to_i)
34
+ File.unlink "/tmp/sidekiq_#{Process.pid}.pid"
35
+ }
@@ -0,0 +1,7 @@
1
+ ---
2
+ :concurrency: 2
3
+ :pidfile: tmp/pids/sidekiq.pid
4
+ :queues:
5
+ - default
6
+ - [critical, 2]
7
+ - [low, 1]
@@ -0,0 +1,22 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ ENV['BUNDLE_GEMFILE'] = Dir.pwd + "/gemfiles/libraries.gemfile"
5
+
6
+ require 'rubygems'
7
+ require 'bundler/setup'
8
+ require_relative '../jobs/db_worker_job'
9
+ require_relative '../jobs/remote_call_worker_job'
10
+ require_relative '../jobs/error_worker_job'
11
+
12
+ ENV["RACK_ENV"] = "test"
13
+ ENV["TRACEVIEW_GEM_TEST"] = "true"
14
+ ENV["TRACEVIEW_GEM_VERBOSE"] = "true"
15
+
16
+ Bundler.require(:default, :test)
17
+
18
+ # Configure TraceView
19
+ TraceView::Config[:tracing_mode] = "always"
20
+ TraceView::Config[:sample_rate] = 1000000
21
+ TraceView.logger.level = Logger::DEBUG
22
+
@@ -30,7 +30,7 @@ describe "TraceView::Config" do
30
30
  instrumentation = TraceView::Config.instrumentation
31
31
 
32
32
  # Verify the number of individual instrumentations
33
- instrumentation.count.must_equal 22
33
+ instrumentation.count.must_equal 24
34
34
 
35
35
  TraceView::Config[:action_controller][:enabled].must_equal true
36
36
  TraceView::Config[:action_view][:enabled].must_equal true
@@ -53,6 +53,8 @@ describe "TraceView::Config" do
53
53
  TraceView::Config[:resque][:enabled].must_equal true
54
54
  TraceView::Config[:rest_client][:enabled].must_equal true
55
55
  TraceView::Config[:sequel][:enabled].must_equal true
56
+ TraceView::Config[:sidekiqclient][:enabled].must_equal true
57
+ TraceView::Config[:sidekiqworker][:enabled].must_equal true
56
58
  TraceView::Config[:typhoeus][:enabled].must_equal true
57
59
 
58
60
  TraceView::Config[:action_controller][:log_args].must_equal true
@@ -76,6 +78,8 @@ describe "TraceView::Config" do
76
78
  TraceView::Config[:resque][:log_args].must_equal true
77
79
  TraceView::Config[:rest_client][:log_args].must_equal true
78
80
  TraceView::Config[:sequel][:log_args].must_equal true
81
+ TraceView::Config[:sidekiqclient][:log_args].must_equal true
82
+ TraceView::Config[:sidekiqworker][:log_args].must_equal true
79
83
  TraceView::Config[:typhoeus][:log_args].must_equal true
80
84
 
81
85
  TraceView::Config[:resque][:link_workers].must_equal false
@@ -1,6 +1,7 @@
1
1
  # Copyright (c) 2015 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
+ require 'set'
4
5
  require 'minitest_helper'
5
6
  require 'rack/test'
6
7
  require 'rack/lobster'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traceview
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: java
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-20 00:00:00.000000000 Z
12
+ date: 2015-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -135,6 +135,8 @@ files:
135
135
  - lib/traceview/inst/resque.rb
136
136
  - lib/traceview/inst/rest-client.rb
137
137
  - lib/traceview/inst/sequel.rb
138
+ - lib/traceview/inst/sidekiq-client.rb
139
+ - lib/traceview/inst/sidekiq-worker.rb
138
140
  - lib/traceview/inst/twitter-cassandra.rb
139
141
  - lib/traceview/inst/typhoeus.rb
140
142
  - lib/traceview/instrumentation.rb
@@ -144,6 +146,7 @@ files:
144
146
  - lib/traceview/method_profiling.rb
145
147
  - lib/traceview/ruby.rb
146
148
  - lib/traceview/support.rb
149
+ - lib/traceview/test.rb
147
150
  - lib/traceview/thread_local.rb
148
151
  - lib/traceview/util.rb
149
152
  - lib/traceview/version.rb
@@ -182,13 +185,22 @@ files:
182
185
  - test/instrumentation/sequel_mysql2_test.rb
183
186
  - test/instrumentation/sequel_mysql_test.rb
184
187
  - test/instrumentation/sequel_pg_test.rb
188
+ - test/instrumentation/sidekiq-client_test.rb
189
+ - test/instrumentation/sidekiq-worker_test.rb
185
190
  - test/instrumentation/typhoeus_test.rb
191
+ - test/jobs/db_worker_job.rb
192
+ - test/jobs/error_worker_job.rb
193
+ - test/jobs/remote_call_worker_job.rb
186
194
  - test/minitest_helper.rb
187
195
  - test/profiling/legacy_method_profiling_test.rb
188
196
  - test/profiling/method_profiling_test.rb
197
+ - test/reporter/reporter_test.rb
189
198
  - test/servers/rackapp_8101.rb
190
199
  - test/servers/rails3x_8140.rb
191
200
  - test/servers/rails4x_8140.rb
201
+ - test/servers/sidekiq.rb
202
+ - test/servers/sidekiq.yml
203
+ - test/servers/sidekiq_initializer.rb
192
204
  - test/support/backcompat_test.rb
193
205
  - test/support/config_test.rb
194
206
  - test/support/dnt_test.rb
@@ -217,14 +229,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
229
  version: '0'
218
230
  requirements: []
219
231
  rubyforge_project:
220
- rubygems_version: 2.4.5
232
+ rubygems_version: 2.4.8
221
233
  signing_key:
222
234
  specification_version: 4
223
235
  summary: AppNeta TraceView performance instrumentation gem for Ruby
224
236
  test_files:
225
237
  - test/minitest_helper.rb
238
+ - test/servers/sidekiq_initializer.rb
226
239
  - test/servers/rails4x_8140.rb
227
240
  - test/servers/rails3x_8140.rb
241
+ - test/servers/sidekiq.rb
228
242
  - test/servers/rackapp_8101.rb
229
243
  - test/instrumentation/excon_test.rb
230
244
  - test/instrumentation/sequel_pg_test.rb
@@ -235,10 +249,12 @@ test_files:
235
249
  - test/instrumentation/dalli_test.rb
236
250
  - test/instrumentation/redis_sortedsets_test.rb
237
251
  - test/instrumentation/rack_test.rb
252
+ - test/instrumentation/sidekiq-client_test.rb
238
253
  - test/instrumentation/cassandra_test.rb
239
254
  - test/instrumentation/redis_strings_test.rb
240
255
  - test/instrumentation/typhoeus_test.rb
241
256
  - test/instrumentation/sequel_mysql2_test.rb
257
+ - test/instrumentation/sidekiq-worker_test.rb
242
258
  - test/instrumentation/redis_misc_test.rb
243
259
  - test/instrumentation/faraday_test.rb
244
260
  - test/instrumentation/redis_keys_test.rb
@@ -252,6 +268,7 @@ test_files:
252
268
  - test/instrumentation/memcached_test.rb
253
269
  - test/instrumentation/em_http_request_test.rb
254
270
  - test/instrumentation/rest-client_test.rb
271
+ - test/reporter/reporter_test.rb
255
272
  - test/profiling/method_profiling_test.rb
256
273
  - test/profiling/legacy_method_profiling_test.rb
257
274
  - test/frameworks/sinatra_test.rb
@@ -270,3 +287,6 @@ test_files:
270
287
  - test/support/liboboe_settings_test.rb
271
288
  - test/support/backcompat_test.rb
272
289
  - test/support/xtrace_test.rb
290
+ - test/jobs/remote_call_worker_job.rb
291
+ - test/jobs/error_worker_job.rb
292
+ - test/jobs/db_worker_job.rb