traceview 3.0.2-java → 3.0.3-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +39 -14
- data/Gemfile +4 -62
- data/Rakefile +23 -8
- data/gemfiles/frameworks.gemfile +40 -0
- data/gemfiles/libraries.gemfile +78 -0
- data/gemfiles/rails23.gemfile +47 -0
- data/gemfiles/rails30.gemfile +47 -0
- data/gemfiles/rails31.gemfile +47 -0
- data/gemfiles/rails32.gemfile +47 -0
- data/gemfiles/rails40.gemfile +35 -0
- data/gemfiles/rails41.gemfile +35 -0
- data/gemfiles/rails42.gemfile +35 -0
- data/lib/traceview/api/logging.rb +84 -38
- data/lib/traceview/frameworks/rails/inst/action_controller.rb +1 -1
- data/lib/traceview/inst/moped.rb +2 -2
- data/lib/traceview/util.rb +30 -34
- data/lib/traceview/version.rb +1 -1
- data/test/frameworks/apps/grape_nested.rb +3 -0
- data/test/frameworks/apps/grape_simple.rb +3 -0
- data/test/frameworks/apps/sinatra_simple.rb +3 -0
- data/test/frameworks/grape_test.rb +8 -4
- data/test/frameworks/padrino_test.rb +6 -2
- data/test/frameworks/rails2x_test.rb +3 -0
- data/test/frameworks/rails3x_test.rb +91 -0
- data/test/frameworks/rails4x_test.rb +89 -0
- data/test/frameworks/sinatra_test.rb +3 -0
- data/test/instrumentation/cassandra_test.rb +11 -4
- data/test/instrumentation/dalli_test.rb +3 -0
- data/test/instrumentation/em_http_request_test.rb +3 -0
- data/test/instrumentation/excon_test.rb +3 -0
- data/test/instrumentation/faraday_test.rb +3 -0
- data/test/instrumentation/http_test.rb +3 -0
- data/test/instrumentation/httpclient_test.rb +3 -0
- data/test/instrumentation/memcache_test.rb +9 -0
- data/test/instrumentation/memcached_test.rb +3 -0
- data/test/instrumentation/mongo_test.rb +14 -3
- data/test/instrumentation/moped_test.rb +29 -6
- data/test/instrumentation/rack_test.rb +3 -0
- data/test/instrumentation/redis_hashes_test.rb +187 -184
- data/test/instrumentation/redis_keys_test.rb +223 -220
- data/test/instrumentation/redis_lists_test.rb +225 -225
- data/test/instrumentation/redis_misc_test.rb +123 -120
- data/test/instrumentation/redis_sets_test.rb +216 -213
- data/test/instrumentation/redis_sortedsets_test.rb +245 -242
- data/test/instrumentation/redis_strings_test.rb +242 -238
- data/test/instrumentation/resque_test.rb +3 -0
- data/test/instrumentation/rest-client_test.rb +3 -0
- data/test/instrumentation/sequel_mysql2_test.rb +4 -1
- data/test/instrumentation/sequel_mysql_test.rb +4 -1
- data/test/instrumentation/sequel_pg_test.rb +4 -1
- data/test/minitest_helper.rb +25 -8
- data/test/profiling/method_test.rb +3 -0
- data/test/servers/rackapp_8101.rb +1 -1
- data/test/servers/rails2x_8140.rb +2 -2
- data/test/servers/rails3x_8140.rb +78 -0
- data/test/servers/rails4x_8140.rb +78 -0
- data/test/support/backcompat_test.rb +3 -0
- data/test/support/config_test.rb +3 -0
- data/test/support/dnt_test.rb +3 -0
- data/test/support/liboboe_settings_test.rb +3 -0
- data/test/support/tvalias_test.rb +3 -0
- data/test/support/xtrace_test.rb +3 -0
- metadata +19 -5
- data/Appraisals +0 -10
- data/gemfiles/mongo.gemfile +0 -33
- data/gemfiles/moped.gemfile +0 -33
data/lib/traceview/version.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
require 'minitest_helper'
|
5
|
+
|
6
|
+
if RUBY_VERSION >= '1.9.3' and defined?(::Grape)
|
3
7
|
require File.expand_path(File.dirname(__FILE__) + '/apps/grape_simple')
|
4
8
|
require File.expand_path(File.dirname(__FILE__) + '/apps/grape_nested')
|
5
9
|
|
@@ -92,8 +96,8 @@ if RUBY_VERSION >= '1.9.3'
|
|
92
96
|
@app = GrapeSimple
|
93
97
|
|
94
98
|
begin
|
95
|
-
|
96
|
-
rescue Exception
|
99
|
+
get "/break"
|
100
|
+
rescue Exception
|
97
101
|
# Do not handle/raise this error so
|
98
102
|
# we can continue to test
|
99
103
|
end
|
@@ -1,5 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
require "minitest_helper"
|
5
|
+
|
6
|
+
if RUBY_VERSION >= '1.9.3' and defined?(::Padrino)
|
3
7
|
require File.expand_path(File.dirname(__FILE__) + '/apps/padrino_simple')
|
4
8
|
|
5
9
|
describe Padrino do
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
require "minitest_helper"
|
5
|
+
|
6
|
+
if defined?(::Rails)
|
7
|
+
|
8
|
+
describe "Rails" do
|
9
|
+
before do
|
10
|
+
clear_all_traces
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should trace a request to a rails stack" do
|
14
|
+
|
15
|
+
uri = URI.parse('http://127.0.0.1:8140/hello/world')
|
16
|
+
r = Net::HTTP.get_response(uri)
|
17
|
+
|
18
|
+
traces = get_all_traces
|
19
|
+
|
20
|
+
traces.count.must_equal 8
|
21
|
+
valid_edges?(traces).must_equal true
|
22
|
+
validate_outer_layers(traces, 'rack')
|
23
|
+
|
24
|
+
traces[0]['Layer'].must_equal "rack"
|
25
|
+
traces[0]['Label'].must_equal "entry"
|
26
|
+
traces[0]['URL'].must_equal "/hello/world"
|
27
|
+
|
28
|
+
traces[1]['Layer'].must_equal "rack"
|
29
|
+
traces[1]['Label'].must_equal "info"
|
30
|
+
|
31
|
+
traces[2]['Layer'].must_equal "rails"
|
32
|
+
traces[2]['Label'].must_equal "entry"
|
33
|
+
|
34
|
+
traces[3]['Label'].must_equal "info"
|
35
|
+
traces[3]['Controller'].must_equal "HelloController"
|
36
|
+
traces[3]['Action'].must_equal "world"
|
37
|
+
|
38
|
+
traces[4]['Layer'].must_equal "actionview"
|
39
|
+
traces[4]['Label'].must_equal "entry"
|
40
|
+
|
41
|
+
traces[5]['Layer'].must_equal "actionview"
|
42
|
+
traces[5]['Label'].must_equal "exit"
|
43
|
+
|
44
|
+
traces[6]['Layer'].must_equal "rails"
|
45
|
+
traces[6]['Label'].must_equal "exit"
|
46
|
+
|
47
|
+
traces[7]['Layer'].must_equal "rack"
|
48
|
+
traces[7]['Label'].must_equal "exit"
|
49
|
+
|
50
|
+
# Validate the existence of the response header
|
51
|
+
r.header.key?('X-Trace').must_equal true
|
52
|
+
r.header['X-Trace'].must_equal traces[7]['X-Trace']
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should trace a request to a rails metal stack" do
|
56
|
+
|
57
|
+
uri = URI.parse('http://127.0.0.1:8140/hello/metal')
|
58
|
+
r = Net::HTTP.get_response(uri)
|
59
|
+
|
60
|
+
traces = get_all_traces
|
61
|
+
|
62
|
+
traces.count.must_equal 5
|
63
|
+
valid_edges?(traces).must_equal true
|
64
|
+
validate_outer_layers(traces, 'rack')
|
65
|
+
|
66
|
+
traces[0]['Layer'].must_equal "rack"
|
67
|
+
traces[0]['Label'].must_equal "entry"
|
68
|
+
traces[0]['URL'].must_equal "/hello/metal"
|
69
|
+
|
70
|
+
traces[1]['Layer'].must_equal "rack"
|
71
|
+
traces[1]['Label'].must_equal "info"
|
72
|
+
|
73
|
+
traces[2]['Label'].must_equal "profile_entry"
|
74
|
+
traces[2]['Language'].must_equal "ruby"
|
75
|
+
traces[2]['ProfileName'].must_equal "world"
|
76
|
+
traces[2]['FunctionName'].must_equal "world"
|
77
|
+
traces[2]['Class'].must_equal "FerroController"
|
78
|
+
|
79
|
+
traces[3]['Label'].must_equal "profile_exit"
|
80
|
+
traces[3]['Language'].must_equal "ruby"
|
81
|
+
traces[3]['ProfileName'].must_equal "world"
|
82
|
+
|
83
|
+
traces[4]['Layer'].must_equal "rack"
|
84
|
+
traces[4]['Label'].must_equal "exit"
|
85
|
+
|
86
|
+
# Validate the existence of the response header
|
87
|
+
r.header.key?('X-Trace').must_equal true
|
88
|
+
r.header['X-Trace'].must_equal traces[4]['X-Trace']
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
require "minitest_helper"
|
5
|
+
|
6
|
+
if defined?(::Rails)
|
7
|
+
|
8
|
+
describe "Rails" do
|
9
|
+
before do
|
10
|
+
clear_all_traces
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should trace a request to a rails stack" do
|
14
|
+
|
15
|
+
uri = URI.parse('http://127.0.0.1:8140/hello/world')
|
16
|
+
r = Net::HTTP.get_response(uri)
|
17
|
+
|
18
|
+
traces = get_all_traces
|
19
|
+
|
20
|
+
traces.count.must_equal 7
|
21
|
+
valid_edges?(traces).must_equal true
|
22
|
+
validate_outer_layers(traces, 'rack')
|
23
|
+
|
24
|
+
traces[0]['Layer'].must_equal "rack"
|
25
|
+
traces[0]['Label'].must_equal "entry"
|
26
|
+
traces[0]['URL'].must_equal "/hello/world"
|
27
|
+
|
28
|
+
traces[1]['Layer'].must_equal "rack"
|
29
|
+
traces[1]['Label'].must_equal "info"
|
30
|
+
|
31
|
+
traces[2]['Layer'].must_equal "rails"
|
32
|
+
traces[2]['Label'].must_equal "entry"
|
33
|
+
traces[2]['Controller'].must_equal "HelloController"
|
34
|
+
traces[2]['Action'].must_equal "world"
|
35
|
+
|
36
|
+
traces[3]['Layer'].must_equal "actionview"
|
37
|
+
traces[3]['Label'].must_equal "entry"
|
38
|
+
|
39
|
+
traces[4]['Layer'].must_equal "actionview"
|
40
|
+
traces[4]['Label'].must_equal "exit"
|
41
|
+
|
42
|
+
traces[5]['Layer'].must_equal "rails"
|
43
|
+
traces[5]['Label'].must_equal "exit"
|
44
|
+
|
45
|
+
traces[6]['Layer'].must_equal "rack"
|
46
|
+
traces[6]['Label'].must_equal "exit"
|
47
|
+
|
48
|
+
# Validate the existence of the response header
|
49
|
+
r.header.key?('X-Trace').must_equal true
|
50
|
+
r.header['X-Trace'].must_equal traces[6]['X-Trace']
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should trace a request to a rails metal stack" do
|
54
|
+
|
55
|
+
uri = URI.parse('http://127.0.0.1:8140/hello/metal')
|
56
|
+
r = Net::HTTP.get_response(uri)
|
57
|
+
|
58
|
+
traces = get_all_traces
|
59
|
+
|
60
|
+
traces.count.must_equal 5
|
61
|
+
valid_edges?(traces).must_equal true
|
62
|
+
validate_outer_layers(traces, 'rack')
|
63
|
+
|
64
|
+
traces[0]['Layer'].must_equal "rack"
|
65
|
+
traces[0]['Label'].must_equal "entry"
|
66
|
+
traces[0]['URL'].must_equal "/hello/metal"
|
67
|
+
|
68
|
+
traces[1]['Layer'].must_equal "rack"
|
69
|
+
traces[1]['Label'].must_equal "info"
|
70
|
+
|
71
|
+
traces[2]['Label'].must_equal "profile_entry"
|
72
|
+
traces[2]['Language'].must_equal "ruby"
|
73
|
+
traces[2]['ProfileName'].must_equal "world"
|
74
|
+
traces[2]['FunctionName'].must_equal "world"
|
75
|
+
traces[2]['Class'].must_equal "FerroController"
|
76
|
+
|
77
|
+
traces[3]['Label'].must_equal "profile_exit"
|
78
|
+
traces[3]['Language'].must_equal "ruby"
|
79
|
+
traces[3]['ProfileName'].must_equal "world"
|
80
|
+
|
81
|
+
traces[4]['Layer'].must_equal "rack"
|
82
|
+
traces[4]['Label'].must_equal "exit"
|
83
|
+
|
84
|
+
# Validate the existence of the response header
|
85
|
+
r.header.key?('X-Trace').must_equal true
|
86
|
+
r.header['X-Trace'].must_equal traces[4]['X-Trace']
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -1,13 +1,20 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
1
4
|
require 'minitest_helper'
|
2
5
|
|
6
|
+
unless ENV['TV_CASSANDRA_SERVER']
|
7
|
+
ENV['TV_CASSANDRA_SERVER'] = "127.0.0.1:9160"
|
8
|
+
end
|
9
|
+
|
3
10
|
# The cassandra-rb client doesn't support JRuby
|
4
11
|
# https://github.com/cassandra-rb/cassandra
|
5
|
-
|
12
|
+
if defined?(::Cassandra) and !defined?(JRUBY_VERSION)
|
6
13
|
describe "Cassandra" do
|
7
14
|
before do
|
8
15
|
clear_all_traces
|
9
16
|
|
10
|
-
@client = Cassandra.new("system",
|
17
|
+
@client = Cassandra.new("system", ENV['TV_CASSANDRA_SERVER'], { :timeout => 10 })
|
11
18
|
@client.disable_node_auto_discovery!
|
12
19
|
|
13
20
|
@ks_name = "AppNetaCassandraTest"
|
@@ -34,8 +41,8 @@ unless defined?(JRUBY_VERSION)
|
|
34
41
|
@entry_kvs = {
|
35
42
|
'Layer' => 'cassandra',
|
36
43
|
'Label' => 'entry',
|
37
|
-
'RemoteHost' => '
|
38
|
-
'RemotePort' => '
|
44
|
+
'RemoteHost' => ENV['TV_CASSANDRA_SERVER'].split(':')[0],
|
45
|
+
'RemotePort' => ENV['TV_CASSANDRA_SERVER'].split(':')[1] }
|
39
46
|
|
40
47
|
@exit_kvs = { 'Layer' => 'cassandra', 'Label' => 'exit' }
|
41
48
|
@collect_backtraces = TraceView::Config[:cassandra][:collect_backtraces]
|
@@ -1,5 +1,14 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
1
4
|
require 'minitest_helper'
|
5
|
+
|
6
|
+
# FIXME: Since memcache is loaded late, the instrumentation
|
7
|
+
# loaded out of order. Here we force inject instrumentation
|
2
8
|
require 'memcache'
|
9
|
+
::MemCache.class_eval do
|
10
|
+
include TraceView::Inst::MemCache
|
11
|
+
end
|
3
12
|
|
4
13
|
describe "Memcache" do
|
5
14
|
before do
|
@@ -1,10 +1,21 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
1
4
|
require 'minitest_helper'
|
2
5
|
|
6
|
+
unless ENV['TV_MONGO_SERVER']
|
7
|
+
ENV['TV_MONGO_SERVER'] = "127.0.0.1:27017"
|
8
|
+
end
|
9
|
+
|
3
10
|
if defined?(::BSON::VERSION) and (BSON::VERSION < "2.0")
|
4
11
|
describe "Mongo" do
|
5
12
|
before do
|
6
13
|
clear_all_traces
|
7
|
-
|
14
|
+
|
15
|
+
@mongo_server = ENV['TV_MONGO_SERVER'].split(':')[0]
|
16
|
+
@mongo_port = ENV['TV_MONGO_SERVER'].split(':')[1]
|
17
|
+
|
18
|
+
@connection = Mongo::Connection.new(@mongo_server, @mongo_port, :slave_ok => true)
|
8
19
|
@db = @connection.db("test-#{ENV['RACK_ENV']}")
|
9
20
|
|
10
21
|
@collections = @db.collection_names
|
@@ -16,8 +27,8 @@ if defined?(::BSON::VERSION) and (BSON::VERSION < "2.0")
|
|
16
27
|
'Label' => 'entry',
|
17
28
|
'Flavor' => 'mongodb',
|
18
29
|
'Database' => 'test-test',
|
19
|
-
'RemoteHost' =>
|
20
|
-
'RemotePort' =>
|
30
|
+
'RemoteHost' => @mongo_server,
|
31
|
+
'RemotePort' => @mongo_port }
|
21
32
|
|
22
33
|
@exit_kvs = { 'Layer' => 'mongo', 'Label' => 'exit' }
|
23
34
|
@collect_backtraces = TraceView::Config[:mongo][:collect_backtraces]
|
@@ -1,14 +1,22 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
1
4
|
require 'minitest_helper'
|
2
5
|
|
6
|
+
unless ENV['TV_MONGO_SERVER']
|
7
|
+
ENV['TV_MONGO_SERVER'] = "127.0.0.1:27017"
|
8
|
+
end
|
9
|
+
|
3
10
|
if RUBY_VERSION >= '1.9.3'
|
4
11
|
# Moped is tested against MRI 1.9.3, 2.0.0, and JRuby (1.9).
|
5
12
|
|
6
13
|
describe "Moped" do
|
7
14
|
before do
|
8
15
|
clear_all_traces
|
9
|
-
@session = Moped::Session.new([
|
16
|
+
@session = Moped::Session.new([ ENV['TV_MONGO_SERVER'] ])
|
10
17
|
@session.use :moped_test
|
11
18
|
@users = @session[:users]
|
19
|
+
@users.drop
|
12
20
|
@users.insert({ :name => "Syd", :city => "Boston" })
|
13
21
|
|
14
22
|
# These are standard entry/exit KVs that are passed up with all moped operations
|
@@ -17,8 +25,8 @@ if RUBY_VERSION >= '1.9.3'
|
|
17
25
|
'Label' => 'entry',
|
18
26
|
'Flavor' => 'mongodb',
|
19
27
|
'Database' => 'moped_test',
|
20
|
-
'RemoteHost' => '
|
21
|
-
'RemotePort' =>
|
28
|
+
'RemoteHost' => ENV['TV_MONGO_SERVER'].split(':')[0],
|
29
|
+
'RemotePort' => ENV['TV_MONGO_SERVER'].split(':')[1].to_i }
|
22
30
|
|
23
31
|
@exit_kvs = { 'Layer' => 'mongo', 'Label' => 'exit' }
|
24
32
|
@collect_backtraces = TraceView::Config[:moped][:collect_backtraces]
|
@@ -252,10 +260,25 @@ if RUBY_VERSION >= '1.9.3'
|
|
252
260
|
end
|
253
261
|
|
254
262
|
it 'should trace find and update' do
|
263
|
+
2.times { @users.insert(:name => "Mary") }
|
264
|
+
mary_count = @users.find(:name => "Mary").count
|
265
|
+
mary_count.wont_equal 0
|
266
|
+
|
267
|
+
tool_count = @users.find(:name => "Tool").count
|
268
|
+
tool_count.must_equal 0
|
269
|
+
|
255
270
|
TraceView::API.start_trace('moped_test', '', {}) do
|
256
|
-
|
271
|
+
old_attrs = { :name => "Mary" }
|
272
|
+
new_attrs = { :name => "Tool" }
|
273
|
+
@users.find(old_attrs).update({ '$set' => new_attrs }, { :multi => true })
|
257
274
|
end
|
258
275
|
|
276
|
+
new_tool_count = @users.find(:name => "Tool").count
|
277
|
+
new_tool_count.must_equal mary_count
|
278
|
+
|
279
|
+
new_mary_count = @users.find(:name => "Mary").count
|
280
|
+
new_mary_count.must_equal 0
|
281
|
+
|
259
282
|
traces = get_all_traces
|
260
283
|
|
261
284
|
traces.count.must_equal 6
|
@@ -270,8 +293,8 @@ if RUBY_VERSION >= '1.9.3'
|
|
270
293
|
|
271
294
|
validate_event_keys(traces[3], @entry_kvs)
|
272
295
|
traces[3]['QueryOp'].must_equal "update"
|
273
|
-
traces[3]['Update_Document'].must_equal "{\"name\":\"Tool\"}"
|
274
|
-
traces[3]['Flags'].must_equal "
|
296
|
+
traces[3]['Update_Document'].must_equal "{\"$set\":{\"name\":\"Tool\"}}"
|
297
|
+
traces[3]['Flags'].must_equal "{:multi=>true}"
|
275
298
|
traces[3]['Collection'].must_equal "users"
|
276
299
|
traces[3].has_key?('Backtrace').must_equal TraceView::Config[:moped][:collect_backtraces]
|
277
300
|
validate_event_keys(traces[4], @exit_kvs)
|