instana 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +2 -0
- data/.gitignore +1 -0
- data/.travis.yml +24 -2
- data/Gemfile +2 -22
- data/README.md +1 -1
- data/Rakefile +15 -0
- data/Tracing.md +29 -2
- data/gemfiles/libraries.gemfile +50 -0
- data/gemfiles/rails32.gemfile +45 -0
- data/gemfiles/rails42.gemfile +44 -0
- data/gemfiles/rails50.gemfile +44 -0
- data/instana.gemspec +6 -8
- data/lib/instana/config.rb +7 -5
- data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +55 -0
- data/lib/instana/frameworks/instrumentation/action_controller.rb +105 -0
- data/lib/instana/frameworks/instrumentation/active_record.rb +22 -0
- data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +81 -0
- data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +56 -0
- data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +71 -0
- data/lib/instana/frameworks/rails.rb +5 -0
- data/lib/instana/test.rb +40 -0
- data/lib/instana/tracer.rb +19 -0
- data/lib/instana/tracing/span.rb +3 -3
- data/lib/instana/version.rb +1 -1
- data/log/.keep +0 -0
- data/test/agent/agent_test.rb +139 -0
- data/test/apps/cuba.rb +15 -0
- data/test/apps/roda.rb +10 -0
- data/test/apps/sinatra.rb +5 -0
- data/test/config_test.rb +17 -0
- data/test/frameworks/cuba_test.rb +44 -0
- data/test/frameworks/rack_test.rb +152 -0
- data/test/frameworks/rails/actioncontroller_test.rb +123 -0
- data/test/frameworks/rails/activerecord3_test.rb +134 -0
- data/test/frameworks/rails/activerecord4_test.rb +134 -0
- data/test/frameworks/rails/activerecord5_test.rb +90 -0
- data/test/frameworks/roda_test.rb +44 -0
- data/test/frameworks/sinatra_test.rb +44 -0
- data/test/instana_test.rb +27 -0
- data/test/instrumentation/dalli_test.rb +274 -0
- data/test/instrumentation/excon_test.rb +171 -0
- data/test/instrumentation/net-http_test.rb +140 -0
- data/test/instrumentation/rest-client_test.rb +61 -0
- data/test/models/block.rb +18 -0
- data/test/servers/rackapp_6511.rb +20 -0
- data/test/servers/rails_3205.rb +95 -0
- data/test/test_helper.rb +39 -0
- data/test/tracing/custom_test.rb +143 -0
- data/test/tracing/id_management_test.rb +96 -0
- data/test/tracing/opentracing_test.rb +377 -0
- data/test/tracing/trace_test.rb +50 -0
- data/test/tracing/tracer_async_test.rb +298 -0
- data/test/tracing/tracer_test.rb +202 -0
- metadata +114 -4
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class ActiveRecordTest < Minitest::Test
|
5
|
+
def test_config_defaults
|
6
|
+
assert ::Instana.config[:active_record].is_a?(Hash)
|
7
|
+
assert ::Instana.config[:active_record].key?(:enabled)
|
8
|
+
assert_equal true, ::Instana.config[:active_record][:enabled]
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_postgresql
|
12
|
+
# Make one call to warm up the Rails stack and allow it to load
|
13
|
+
# relations
|
14
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
15
|
+
|
16
|
+
skip unless ::Instana::Test.postgresql?
|
17
|
+
|
18
|
+
clear_all!
|
19
|
+
|
20
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
21
|
+
|
22
|
+
traces = Instana.processor.queued_traces
|
23
|
+
assert_equal 1, traces.count
|
24
|
+
trace = traces.first
|
25
|
+
|
26
|
+
assert_equal 5, trace.spans.count
|
27
|
+
spans = trace.spans.to_a
|
28
|
+
first_span = spans[0]
|
29
|
+
second_span = spans[2]
|
30
|
+
third_span = spans[3]
|
31
|
+
fourth_span = spans[4]
|
32
|
+
|
33
|
+
assert_equal :rack, first_span.name
|
34
|
+
assert_equal :activerecord, second_span.name
|
35
|
+
assert_equal :activerecord, third_span.name
|
36
|
+
assert_equal :activerecord, fourth_span.name
|
37
|
+
|
38
|
+
assert_equal "INSERT INTO \"blocks\" (\"color\", \"created_at\", \"name\", \"updated_at\") VALUES ($?, $?, $?, $?) RETURNING \"id\"", second_span[:data][:activerecord][:sql]
|
39
|
+
assert_equal "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = ? LIMIT ?", third_span[:data][:activerecord][:sql]
|
40
|
+
assert_equal "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = ?", fourth_span[:data][:activerecord][:sql]
|
41
|
+
|
42
|
+
assert_equal "postgresql", second_span[:data][:activerecord][:adapter]
|
43
|
+
assert_equal "postgresql", third_span[:data][:activerecord][:adapter]
|
44
|
+
assert_equal "postgresql", fourth_span[:data][:activerecord][:adapter]
|
45
|
+
|
46
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], second_span[:data][:activerecord][:host]
|
47
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], third_span[:data][:activerecord][:host]
|
48
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], fourth_span[:data][:activerecord][:host]
|
49
|
+
|
50
|
+
assert_equal "postgres", second_span[:data][:activerecord][:username]
|
51
|
+
assert_equal "postgres", third_span[:data][:activerecord][:username]
|
52
|
+
assert_equal "postgres", fourth_span[:data][:activerecord][:username]
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_mysql2
|
56
|
+
skip unless ::Instana::Test.mysql2?
|
57
|
+
|
58
|
+
clear_all!
|
59
|
+
|
60
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
61
|
+
|
62
|
+
traces = Instana.processor.queued_traces
|
63
|
+
assert_equal 1, traces.count
|
64
|
+
trace = traces.first
|
65
|
+
|
66
|
+
assert_equal 5, trace.spans.count
|
67
|
+
spans = trace.spans.to_a
|
68
|
+
first_span = spans[0]
|
69
|
+
second_span = spans[2]
|
70
|
+
third_span = spans[3]
|
71
|
+
fourth_span = spans[4]
|
72
|
+
|
73
|
+
assert_equal :rack, first_span.name
|
74
|
+
assert_equal :activerecord, second_span.name
|
75
|
+
assert_equal :activerecord, third_span.name
|
76
|
+
assert_equal :activerecord, fourth_span.name
|
77
|
+
|
78
|
+
assert_equal "INSERT INTO `blocks` (`color`, `created_at`, `name`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
|
79
|
+
assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? LIMIT ?", third_span[:data][:activerecord][:sql]
|
80
|
+
assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
|
81
|
+
|
82
|
+
assert_equal "mysql2", second_span[:data][:activerecord][:adapter]
|
83
|
+
assert_equal "mysql2", third_span[:data][:activerecord][:adapter]
|
84
|
+
assert_equal "mysql2", fourth_span[:data][:activerecord][:adapter]
|
85
|
+
|
86
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
|
87
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
|
88
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
|
89
|
+
|
90
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
|
91
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
|
92
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_mysql
|
96
|
+
skip unless ::Instana::Test.mysql?
|
97
|
+
|
98
|
+
clear_all!
|
99
|
+
|
100
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
101
|
+
|
102
|
+
traces = Instana.processor.queued_traces
|
103
|
+
assert_equal 1, traces.count
|
104
|
+
trace = traces.first
|
105
|
+
|
106
|
+
assert_equal 5, trace.spans.count
|
107
|
+
spans = trace.spans.to_a
|
108
|
+
first_span = spans[0]
|
109
|
+
second_span = spans[2]
|
110
|
+
third_span = spans[3]
|
111
|
+
fourth_span = spans[4]
|
112
|
+
|
113
|
+
assert_equal :rack, first_span.name
|
114
|
+
assert_equal :activerecord, second_span.name
|
115
|
+
assert_equal :activerecord, third_span.name
|
116
|
+
assert_equal :activerecord, fourth_span.name
|
117
|
+
|
118
|
+
assert_equal "INSERT INTO `blocks` (`color`, `created_at`, `name`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
|
119
|
+
assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? LIMIT ?", third_span[:data][:activerecord][:sql]
|
120
|
+
assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
|
121
|
+
|
122
|
+
assert_equal "mysql", second_span[:data][:activerecord][:adapter]
|
123
|
+
assert_equal "mysql", third_span[:data][:activerecord][:adapter]
|
124
|
+
assert_equal "mysql", fourth_span[:data][:activerecord][:adapter]
|
125
|
+
|
126
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
|
127
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
|
128
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
|
129
|
+
|
130
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
|
131
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
|
132
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class ActiveRecordPgTest < Minitest::Test
|
5
|
+
def test_config_defaults
|
6
|
+
assert ::Instana.config[:active_record].is_a?(Hash)
|
7
|
+
assert ::Instana.config[:active_record].key?(:enabled)
|
8
|
+
assert_equal true, ::Instana.config[:active_record][:enabled]
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_postgresql
|
12
|
+
# Make one call to warm up the Rails stack and allow it to load
|
13
|
+
# relations
|
14
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
15
|
+
|
16
|
+
skip unless ::Instana::Test.postgresql?
|
17
|
+
|
18
|
+
clear_all!
|
19
|
+
|
20
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
21
|
+
|
22
|
+
traces = Instana.processor.queued_traces
|
23
|
+
assert_equal 1, traces.count
|
24
|
+
trace = traces.first
|
25
|
+
|
26
|
+
assert_equal 5, trace.spans.count
|
27
|
+
spans = trace.spans.to_a
|
28
|
+
first_span = spans[0]
|
29
|
+
second_span = spans[2]
|
30
|
+
third_span = spans[3]
|
31
|
+
fourth_span = spans[4]
|
32
|
+
|
33
|
+
assert_equal :rack, first_span.name
|
34
|
+
assert_equal :activerecord, second_span.name
|
35
|
+
assert_equal :activerecord, third_span.name
|
36
|
+
assert_equal :activerecord, fourth_span.name
|
37
|
+
|
38
|
+
assert_equal "INSERT INTO \"blocks\" (\"name\", \"color\", \"created_at\", \"updated_at\") VALUES ($?, $?, $?, $?) RETURNING \"id\"", second_span[:data][:activerecord][:sql]
|
39
|
+
assert_equal "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = $? ORDER BY \"blocks\".\"id\" ASC LIMIT ?", third_span[:data][:activerecord][:sql]
|
40
|
+
assert_equal "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = $?", fourth_span[:data][:activerecord][:sql]
|
41
|
+
|
42
|
+
assert_equal "postgresql", second_span[:data][:activerecord][:adapter]
|
43
|
+
assert_equal "postgresql", third_span[:data][:activerecord][:adapter]
|
44
|
+
assert_equal "postgresql", fourth_span[:data][:activerecord][:adapter]
|
45
|
+
|
46
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], second_span[:data][:activerecord][:host]
|
47
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], third_span[:data][:activerecord][:host]
|
48
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], fourth_span[:data][:activerecord][:host]
|
49
|
+
|
50
|
+
assert_equal "postgres", second_span[:data][:activerecord][:username]
|
51
|
+
assert_equal "postgres", third_span[:data][:activerecord][:username]
|
52
|
+
assert_equal "postgres", fourth_span[:data][:activerecord][:username]
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_mysql2
|
56
|
+
skip unless ::Instana::Test.mysql2?
|
57
|
+
|
58
|
+
clear_all!
|
59
|
+
|
60
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
61
|
+
|
62
|
+
traces = Instana.processor.queued_traces
|
63
|
+
assert_equal 1, traces.count
|
64
|
+
trace = traces.first
|
65
|
+
|
66
|
+
assert_equal 5, trace.spans.count
|
67
|
+
spans = trace.spans.to_a
|
68
|
+
first_span = spans[0]
|
69
|
+
second_span = spans[2]
|
70
|
+
third_span = spans[3]
|
71
|
+
fourth_span = spans[4]
|
72
|
+
|
73
|
+
assert_equal :rack, first_span.name
|
74
|
+
assert_equal :activerecord, second_span.name
|
75
|
+
assert_equal :activerecord, third_span.name
|
76
|
+
assert_equal :activerecord, fourth_span.name
|
77
|
+
|
78
|
+
assert_equal "INSERT INTO `blocks` (`name`, `color`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
|
79
|
+
assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? ORDER BY `blocks`.`id` ASC LIMIT ?", third_span[:data][:activerecord][:sql]
|
80
|
+
assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
|
81
|
+
|
82
|
+
assert_equal "mysql2", second_span[:data][:activerecord][:adapter]
|
83
|
+
assert_equal "mysql2", third_span[:data][:activerecord][:adapter]
|
84
|
+
assert_equal "mysql2", fourth_span[:data][:activerecord][:adapter]
|
85
|
+
|
86
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
|
87
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
|
88
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
|
89
|
+
|
90
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
|
91
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
|
92
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_mysql
|
96
|
+
skip unless ::Instana::Test.mysql?
|
97
|
+
|
98
|
+
clear_all!
|
99
|
+
|
100
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
101
|
+
|
102
|
+
traces = Instana.processor.queued_traces
|
103
|
+
assert_equal 1, traces.count
|
104
|
+
trace = traces.first
|
105
|
+
|
106
|
+
assert_equal 5, trace.spans.count
|
107
|
+
spans = trace.spans.to_a
|
108
|
+
first_span = spans[0]
|
109
|
+
second_span = spans[2]
|
110
|
+
third_span = spans[3]
|
111
|
+
fourth_span = spans[4]
|
112
|
+
|
113
|
+
assert_equal :rack, first_span.name
|
114
|
+
assert_equal :activerecord, second_span.name
|
115
|
+
assert_equal :activerecord, third_span.name
|
116
|
+
assert_equal :activerecord, fourth_span.name
|
117
|
+
|
118
|
+
assert_equal "INSERT INTO `blocks` (`name`, `color`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
|
119
|
+
assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? ORDER BY `blocks`.`id` ASC LIMIT ?", third_span[:data][:activerecord][:sql]
|
120
|
+
assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
|
121
|
+
|
122
|
+
assert_equal "mysql", second_span[:data][:activerecord][:adapter]
|
123
|
+
assert_equal "mysql", third_span[:data][:activerecord][:adapter]
|
124
|
+
assert_equal "mysql", fourth_span[:data][:activerecord][:adapter]
|
125
|
+
|
126
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
|
127
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
|
128
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
|
129
|
+
|
130
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
|
131
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
|
132
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class ActiveRecordTest < Minitest::Test
|
5
|
+
def test_config_defaults
|
6
|
+
assert ::Instana.config[:active_record].is_a?(Hash)
|
7
|
+
assert ::Instana.config[:active_record].key?(:enabled)
|
8
|
+
assert_equal true, ::Instana.config[:active_record][:enabled]
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_postgresql
|
12
|
+
skip unless ::Instana::Test.postgresql?
|
13
|
+
|
14
|
+
clear_all!
|
15
|
+
|
16
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
17
|
+
|
18
|
+
traces = Instana.processor.queued_traces
|
19
|
+
assert_equal 1, traces.count
|
20
|
+
trace = traces.first
|
21
|
+
|
22
|
+
assert_equal 5, trace.spans.count
|
23
|
+
spans = trace.spans.to_a
|
24
|
+
first_span = spans[0]
|
25
|
+
second_span = spans[2]
|
26
|
+
third_span = spans[3]
|
27
|
+
fourth_span = spans[4]
|
28
|
+
|
29
|
+
assert_equal :rack, first_span.name
|
30
|
+
assert_equal :activerecord, second_span.name
|
31
|
+
assert_equal :activerecord, third_span.name
|
32
|
+
assert_equal :activerecord, fourth_span.name
|
33
|
+
|
34
|
+
assert_equal "INSERT INTO \"blocks\" (\"name\", \"color\", \"created_at\", \"updated_at\") VALUES ($?, $?, $?, $?) RETURNING \"id\"", second_span[:data][:activerecord][:sql]
|
35
|
+
assert_equal "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = $? ORDER BY \"blocks\".\"id\" ASC LIMIT $?", third_span[:data][:activerecord][:sql]
|
36
|
+
assert_equal "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = $?", fourth_span[:data][:activerecord][:sql]
|
37
|
+
|
38
|
+
assert_equal "postgresql", second_span[:data][:activerecord][:adapter]
|
39
|
+
assert_equal "postgresql", third_span[:data][:activerecord][:adapter]
|
40
|
+
assert_equal "postgresql", fourth_span[:data][:activerecord][:adapter]
|
41
|
+
|
42
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], second_span[:data][:activerecord][:host]
|
43
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], third_span[:data][:activerecord][:host]
|
44
|
+
assert_equal ENV['TRAVIS_PSQL_HOST'], fourth_span[:data][:activerecord][:host]
|
45
|
+
|
46
|
+
assert_equal "postgres", second_span[:data][:activerecord][:username]
|
47
|
+
assert_equal "postgres", third_span[:data][:activerecord][:username]
|
48
|
+
assert_equal "postgres", fourth_span[:data][:activerecord][:username]
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_mysql2
|
52
|
+
skip unless ::Instana::Test.mysql2?
|
53
|
+
|
54
|
+
clear_all!
|
55
|
+
|
56
|
+
Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
|
57
|
+
|
58
|
+
traces = Instana.processor.queued_traces
|
59
|
+
assert_equal 1, traces.count
|
60
|
+
trace = traces.first
|
61
|
+
|
62
|
+
assert_equal 5, trace.spans.count
|
63
|
+
spans = trace.spans.to_a
|
64
|
+
first_span = spans[0]
|
65
|
+
second_span = spans[2]
|
66
|
+
third_span = spans[3]
|
67
|
+
fourth_span = spans[4]
|
68
|
+
|
69
|
+
assert_equal :rack, first_span.name
|
70
|
+
assert_equal :activerecord, second_span.name
|
71
|
+
assert_equal :activerecord, third_span.name
|
72
|
+
assert_equal :activerecord, fourth_span.name
|
73
|
+
|
74
|
+
assert_equal "INSERT INTO `blocks` (`name`, `color`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
|
75
|
+
assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? ORDER BY `blocks`.`id` ASC LIMIT ?", third_span[:data][:activerecord][:sql]
|
76
|
+
assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
|
77
|
+
|
78
|
+
assert_equal "mysql2", second_span[:data][:activerecord][:adapter]
|
79
|
+
assert_equal "mysql2", third_span[:data][:activerecord][:adapter]
|
80
|
+
assert_equal "mysql2", fourth_span[:data][:activerecord][:adapter]
|
81
|
+
|
82
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
|
83
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
|
84
|
+
assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
|
85
|
+
|
86
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
|
87
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
|
88
|
+
assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
if defined?(::Roda)
|
3
|
+
require 'test_helper'
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + '/../apps/roda')
|
5
|
+
require 'rack/test'
|
6
|
+
|
7
|
+
class RodaTest < Minitest::Test
|
8
|
+
include Rack::Test::Methods
|
9
|
+
|
10
|
+
def app
|
11
|
+
InstanaRodaApp
|
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,44 @@
|
|
1
|
+
|
2
|
+
if defined?(::Sinatra)
|
3
|
+
require 'test_helper'
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + '/../apps/sinatra')
|
5
|
+
require 'rack/test'
|
6
|
+
|
7
|
+
class SinatraTest < Minitest::Test
|
8
|
+
include Rack::Test::Methods
|
9
|
+
|
10
|
+
def app
|
11
|
+
InstanaSinatraApp
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_basic_get
|
15
|
+
clear_all!
|
16
|
+
|
17
|
+
r = get '/'
|
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 "/", 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
|