instana 1.193.3.pre1 → 1.193.3
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/.circleci/config.yml +18 -12
- data/.gitignore +2 -1
- data/Appraisals +4 -0
- data/gemfiles/cuba_30.gemfile +1 -0
- data/gemfiles/dalli_20.gemfile +1 -0
- data/gemfiles/excon_02.gemfile +1 -0
- data/gemfiles/graphql_10.gemfile +1 -0
- data/gemfiles/grpc_10.gemfile +1 -0
- data/gemfiles/net_http_01.gemfile +1 -0
- data/gemfiles/rack_16.gemfile +1 -0
- data/gemfiles/rack_20.gemfile +1 -0
- data/gemfiles/rails_42.gemfile +2 -0
- data/gemfiles/rails_50.gemfile +2 -0
- data/gemfiles/rails_52.gemfile +2 -0
- data/gemfiles/rails_60.gemfile +2 -0
- data/gemfiles/redis_40.gemfile +1 -0
- data/gemfiles/resque_122.gemfile +1 -0
- data/gemfiles/resque_20.gemfile +1 -0
- data/gemfiles/rest_client_16.gemfile +1 -0
- data/gemfiles/rest_client_20.gemfile +1 -0
- data/gemfiles/roda_20.gemfile +1 -0
- data/gemfiles/roda_30.gemfile +1 -0
- data/gemfiles/sidekiq_42.gemfile +1 -0
- data/gemfiles/sidekiq_50.gemfile +1 -0
- data/gemfiles/sinatra_14.gemfile +1 -0
- data/lib/instana/activators/action_controller_api.rb +18 -0
- data/lib/instana/activators/action_controller_base.rb +18 -0
- data/lib/instana/activators/action_view.rb +18 -0
- data/lib/instana/activators/active_record.rb +18 -0
- data/lib/instana/frameworks/rails.rb +20 -32
- data/lib/instana/instrumentation/action_controller.rb +81 -0
- data/lib/instana/instrumentation/action_view.rb +27 -0
- data/lib/instana/instrumentation/active_record.rb +47 -0
- data/lib/instana/version.rb +1 -1
- data/test/{frameworks/rails/actioncontroller_test.rb → instrumentation/rails_action_controller_test.rb} +37 -21
- data/test/instrumentation/rails_action_view_test.rb +138 -0
- data/test/instrumentation/rails_active_record_test.rb +121 -0
- data/test/support/apps/active_record/active_record.rb +21 -0
- metadata +19 -23
- data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +0 -56
- data/lib/instana/frameworks/instrumentation/action_controller.rb +0 -194
- data/lib/instana/frameworks/instrumentation/action_view.rb +0 -39
- data/lib/instana/frameworks/instrumentation/active_record.rb +0 -27
- data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +0 -83
- data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +0 -60
- data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +0 -99
- data/test/frameworks/rails/actionview3_test.rb +0 -210
- data/test/frameworks/rails/actionview4_test.rb +0 -208
- data/test/frameworks/rails/actionview5_test.rb +0 -221
- data/test/frameworks/rails/activerecord_test.rb +0 -279
- data/test/frameworks/rails_test.rb +0 -15
@@ -1,39 +0,0 @@
|
|
1
|
-
module Instana
|
2
|
-
module Instrumentation
|
3
|
-
module ActionViewRenderer
|
4
|
-
def render_partial(*args)
|
5
|
-
kv_payload = { :render => {} }
|
6
|
-
kv_payload[:render][:type] = :partial
|
7
|
-
kv_payload[:render][:name] = @options[:partial].to_s if @options.is_a?(Hash)
|
8
|
-
|
9
|
-
::Instana.tracer.log_entry(:render, kv_payload)
|
10
|
-
super(*args)
|
11
|
-
rescue Exception => e
|
12
|
-
::Instana.tracer.log_error(e)
|
13
|
-
raise
|
14
|
-
ensure
|
15
|
-
::Instana.tracer.log_exit(:render)
|
16
|
-
end
|
17
|
-
|
18
|
-
def render_collection(*args)
|
19
|
-
puts 'called'
|
20
|
-
kv_payload = { :render => {} }
|
21
|
-
kv_payload[:render][:type] = :collection
|
22
|
-
kv_payload[:render][:name] = @path.to_s
|
23
|
-
|
24
|
-
::Instana.tracer.log_entry(:render, kv_payload)
|
25
|
-
super(*args)
|
26
|
-
rescue Exception => e
|
27
|
-
::Instana.tracer.log_error(e)
|
28
|
-
raise
|
29
|
-
ensure
|
30
|
-
::Instana.tracer.log_exit(:render)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
if defined?(::ActionView) && ::Instana.config[:action_view][:enabled] && ::ActionPack::VERSION::STRING >= '3.1'
|
37
|
-
::Instana.logger.debug "Instrumenting ActionView"
|
38
|
-
::ActionView::PartialRenderer.send(:prepend, ::Instana::Instrumentation::ActionViewRenderer)
|
39
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
|
2
|
-
require "instana/frameworks/instrumentation/mysql_adapter"
|
3
|
-
require "instana/frameworks/instrumentation/abstract_mysql_adapter"
|
4
|
-
require "instana/frameworks/instrumentation/mysql2_adapter"
|
5
|
-
require "instana/frameworks/instrumentation/postgresql_adapter"
|
6
|
-
|
7
|
-
if defined?(::ActiveRecord) && ::Instana.config[:active_record][:enabled]
|
8
|
-
|
9
|
-
# Mysql
|
10
|
-
if defined?(ActiveRecord::ConnectionAdapters::MysqlAdapter)
|
11
|
-
::Instana.logger.debug "Instrumenting ActiveRecord (mysql)"
|
12
|
-
ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:prepend, ::Instana::Instrumentation::MysqlAdapter)
|
13
|
-
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.send(:prepend, ::Instana::Instrumentation::AbstractMysqlAdapter)
|
14
|
-
end
|
15
|
-
|
16
|
-
# Mysql2
|
17
|
-
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
|
18
|
-
::Instana.logger.debug "Instrumenting ActiveRecord (mysql2)"
|
19
|
-
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:prepend, ::Instana::Instrumentation::Mysql2Adapter)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Postgres
|
23
|
-
if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
24
|
-
::Instana.logger.debug "Instrumenting ActiveRecord (postgresql)"
|
25
|
-
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:prepend, ::Instana::Instrumentation::PostgreSQLAdapter)
|
26
|
-
end
|
27
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
module Instana
|
2
|
-
module Instrumentation
|
3
|
-
module Mysql2Adapter
|
4
|
-
IGNORED_PAYLOADS = %w(SCHEMA EXPLAIN CACHE).freeze
|
5
|
-
EXPLAINED_SQLS = /\A\s*(with|select|update|delete|insert)\b/i
|
6
|
-
|
7
|
-
# This module supports instrumenting ActiveRecord with the mysql2 adapter.
|
8
|
-
#
|
9
|
-
def self.prepended(klass)
|
10
|
-
# ActiveRecord 3.1 and up only (for now possibly)
|
11
|
-
if ActiveRecord::VERSION::STRING > '3.0'
|
12
|
-
@@sanitize_regexp = Regexp.new('(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)', Regexp::IGNORECASE)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# Collect up this DB connection info for reporting.
|
17
|
-
#
|
18
|
-
# @param sql [String]
|
19
|
-
# @return [Hash] Hash of collected KVs
|
20
|
-
#
|
21
|
-
def collect(sql)
|
22
|
-
payload = { :activerecord => {} }
|
23
|
-
|
24
|
-
if ::Instana.config[:sanitize_sql]
|
25
|
-
payload[:activerecord][:sql] = sql.gsub(@@sanitize_regexp, '?')
|
26
|
-
else
|
27
|
-
payload[:activerecord][:sql] = sql
|
28
|
-
end
|
29
|
-
|
30
|
-
payload[:activerecord][:adapter] = @config[:adapter]
|
31
|
-
payload[:activerecord][:host] = @config[:host]
|
32
|
-
payload[:activerecord][:db] = @config[:database]
|
33
|
-
payload[:activerecord][:username] = @config[:username]
|
34
|
-
payload
|
35
|
-
end
|
36
|
-
|
37
|
-
# In the spirit of ::ActiveRecord::ExplainSubscriber.ignore_payload? There are
|
38
|
-
# only certain calls that we're interested in tracing. e.g. No use to instrument
|
39
|
-
# framework caches.
|
40
|
-
#
|
41
|
-
# @param payload [String]
|
42
|
-
# @return [Boolean]
|
43
|
-
#
|
44
|
-
def ignore_payload?(name, sql)
|
45
|
-
IGNORED_PAYLOADS.include?(name) || sql !~ EXPLAINED_SQLS
|
46
|
-
end
|
47
|
-
|
48
|
-
def exec_delete(sql, name = nil, binds = [])
|
49
|
-
if !::Instana.tracer.tracing? || ignore_payload?(name, sql)
|
50
|
-
return super(sql, name, binds)
|
51
|
-
end
|
52
|
-
|
53
|
-
kv_payload = collect(sql)
|
54
|
-
::Instana.tracer.trace(:activerecord, kv_payload) do
|
55
|
-
super(sql, name, binds)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def exec_insert(sql, name = 'SQL', binds = [], *args)
|
60
|
-
if !::Instana.tracer.tracing? || ignore_payload?(name, sql)
|
61
|
-
return super(sql, name, binds, *args)
|
62
|
-
end
|
63
|
-
|
64
|
-
kv_payload = collect(sql)
|
65
|
-
::Instana.tracer.trace(:activerecord, kv_payload) do
|
66
|
-
super(sql, name, binds, *args)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def exec_query(sql, name = 'SQL', binds = [], *args)
|
71
|
-
if !::Instana.tracer.tracing? || ignore_payload?(name, sql) ||
|
72
|
-
::Instana.tracer.current_span[:n] == :activerecord
|
73
|
-
return super(sql, name, binds, *args)
|
74
|
-
end
|
75
|
-
|
76
|
-
kv_payload = collect(sql)
|
77
|
-
::Instana.tracer.trace(:activerecord, kv_payload) do
|
78
|
-
super(sql, name, binds, *args)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module Instana
|
2
|
-
module Instrumentation
|
3
|
-
module MysqlAdapter
|
4
|
-
IGNORED_PAYLOADS = %w(SCHEMA EXPLAIN CACHE).freeze
|
5
|
-
EXPLAINED_SQLS = /\A\s*(with|select|update|delete|insert)\b/i
|
6
|
-
|
7
|
-
# This module supports instrumenting ActiveRecord with the mysql2 adapter.
|
8
|
-
#
|
9
|
-
def self.prepended(klass)
|
10
|
-
if ActiveRecord::VERSION::STRING >= '3.2'
|
11
|
-
@@sanitize_regexp = Regexp.new('(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)', Regexp::IGNORECASE)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# Collect up this DB connection info for reporting.
|
16
|
-
#
|
17
|
-
# @param sql [String]
|
18
|
-
# @return [Hash] Hash of collected KVs
|
19
|
-
#
|
20
|
-
def collect(sql)
|
21
|
-
payload = { :activerecord => {} }
|
22
|
-
|
23
|
-
if ::Instana.config[:sanitize_sql]
|
24
|
-
payload[:activerecord][:sql] = sql.gsub(@@sanitize_regexp, '?')
|
25
|
-
else
|
26
|
-
payload[:activerecord][:sql] = sql
|
27
|
-
end
|
28
|
-
|
29
|
-
payload[:activerecord][:adapter] = @config[:adapter]
|
30
|
-
payload[:activerecord][:host] = @config[:host]
|
31
|
-
payload[:activerecord][:db] = @config[:database]
|
32
|
-
payload[:activerecord][:username] = @config[:username]
|
33
|
-
payload
|
34
|
-
end
|
35
|
-
|
36
|
-
# In the spirit of ::ActiveRecord::ExplainSubscriber.ignore_payload? There are
|
37
|
-
# only certain calls that we're interested in tracing. e.g. No use to instrument
|
38
|
-
# framework caches.
|
39
|
-
#
|
40
|
-
# @param payload [String]
|
41
|
-
# @return [Boolean]
|
42
|
-
#
|
43
|
-
def ignore_payload?(name, sql)
|
44
|
-
IGNORED_PAYLOADS.include?(name) || sql !~ EXPLAINED_SQLS
|
45
|
-
end
|
46
|
-
|
47
|
-
def exec_query(sql, name = 'SQL', binds = [], *args)
|
48
|
-
if !::Instana.tracer.tracing? || ignore_payload?(name, sql) ||
|
49
|
-
::Instana.tracer.current_span[:n] == :activerecord
|
50
|
-
return super(sql, name, binds, *args)
|
51
|
-
end
|
52
|
-
|
53
|
-
kv_payload = collect(sql)
|
54
|
-
::Instana.tracer.trace(:activerecord, kv_payload) do
|
55
|
-
super(sql, name, binds, *args)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
module Instana
|
2
|
-
module Instrumentation
|
3
|
-
module PostgreSQLAdapter
|
4
|
-
IGNORED_PAYLOADS = %w(SCHEMA EXPLAIN CACHE).freeze
|
5
|
-
IGNORED_SQL = %w(BEGIN COMMIT)
|
6
|
-
EXPLAINED_SQLS = /\A\s*(with|select|update|delete|insert)\b/i
|
7
|
-
|
8
|
-
# This module supports instrumenting ActiveRecord with the postgresql adapter. Only
|
9
|
-
# versions >= 3.1 are supported.
|
10
|
-
#
|
11
|
-
def self.prepended(klass)
|
12
|
-
if (::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR > 0) ||
|
13
|
-
::ActiveRecord::VERSION::MAJOR >= 4
|
14
|
-
|
15
|
-
# ActiveRecord 3.1 and up
|
16
|
-
@@sanitize_regexp = Regexp.new('(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)', Regexp::IGNORECASE)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# Collect up this DB connection info for reporting.
|
21
|
-
#
|
22
|
-
# @param sql [String]
|
23
|
-
# @return [Hash] Hash of collected KVs
|
24
|
-
#
|
25
|
-
def collect(sql, binds = nil)
|
26
|
-
payload = { :activerecord => {} }
|
27
|
-
|
28
|
-
payload[:activerecord][:adapter] = @config[:adapter]
|
29
|
-
payload[:activerecord][:host] = @config[:host]
|
30
|
-
payload[:activerecord][:db] = @config[:database]
|
31
|
-
payload[:activerecord][:username] = @config[:username]
|
32
|
-
|
33
|
-
if ::Instana.config[:sanitize_sql]
|
34
|
-
payload[:activerecord][:sql] = sql.gsub(@@sanitize_regexp, '?')
|
35
|
-
else
|
36
|
-
# No sanitization so raw SQL and collect up binds
|
37
|
-
payload[:activerecord][:sql] = sql
|
38
|
-
|
39
|
-
# FIXME: Only works on Rails 5 as the bind format varied in previous versions of Rails
|
40
|
-
if binds.is_a?(Array)
|
41
|
-
raw_binds = []
|
42
|
-
binds.each { |x| raw_binds << x.value_before_type_cast }
|
43
|
-
payload[:activerecord][:binds] = raw_binds
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
payload
|
48
|
-
rescue Exception => e
|
49
|
-
::Instana.logger.debug { "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" }
|
50
|
-
ensure
|
51
|
-
return payload
|
52
|
-
end
|
53
|
-
|
54
|
-
# In the spirit of ::ActiveRecord::ExplainSubscriber.ignore_payload? There are
|
55
|
-
# only certain calls that we're interested in tracing. e.g. No use to instrument
|
56
|
-
# framework caches.
|
57
|
-
#
|
58
|
-
# @param payload [String]
|
59
|
-
# @return [Boolean]
|
60
|
-
#
|
61
|
-
def ignore_payload?(name, sql)
|
62
|
-
IGNORED_PAYLOADS.include?(name) || IGNORED_SQL.include?(sql)
|
63
|
-
end
|
64
|
-
|
65
|
-
def exec_query(sql, name = 'SQL', binds = [], *args)
|
66
|
-
if !::Instana.tracer.tracing? || ignore_payload?(name, sql)
|
67
|
-
return super(sql, name, binds, *args)
|
68
|
-
end
|
69
|
-
|
70
|
-
kv_payload = collect(sql, binds)
|
71
|
-
::Instana.tracer.trace(:activerecord, kv_payload) do
|
72
|
-
super(sql, name, binds, *args)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def exec_delete(sql, name = nil, binds = [])
|
77
|
-
if !::Instana.tracer.tracing? || ignore_payload?(name, sql)
|
78
|
-
return super(sql, name, binds)
|
79
|
-
end
|
80
|
-
|
81
|
-
kv_payload = collect(sql, binds)
|
82
|
-
::Instana.tracer.trace(:activerecord, kv_payload) do
|
83
|
-
super(sql, name, binds)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def execute(sql, name = nil)
|
88
|
-
if !::Instana.tracer.tracing? || ignore_payload?(name, sql)
|
89
|
-
return super(sql, name)
|
90
|
-
end
|
91
|
-
|
92
|
-
kv_payload = collect(sql)
|
93
|
-
::Instana.tracer.trace(:activerecord, kv_payload) do
|
94
|
-
super(sql, name)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -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
|