instana 1.13.0 → 1.193.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +200 -133
  3. data/.editorconfig +10 -0
  4. data/.gitignore +3 -0
  5. data/.rubocop.yml +5 -1147
  6. data/.rubocop_todo.yml +1140 -0
  7. data/Appraisals +100 -0
  8. data/Gemfile +11 -32
  9. data/Rakefile +16 -39
  10. data/bin/console +5 -4
  11. data/gemfiles/.bundle/config +1 -2
  12. data/gemfiles/cuba_30.gemfile +15 -0
  13. data/gemfiles/dalli_20.gemfile +15 -0
  14. data/gemfiles/excon_02.gemfile +15 -0
  15. data/gemfiles/graphql_10.gemfile +15 -0
  16. data/gemfiles/grpc_10.gemfile +15 -0
  17. data/gemfiles/net_http_01.gemfile +14 -0
  18. data/gemfiles/rack_16.gemfile +15 -0
  19. data/gemfiles/rack_20.gemfile +15 -0
  20. data/gemfiles/rails_42.gemfile +18 -0
  21. data/gemfiles/rails_50.gemfile +18 -0
  22. data/gemfiles/rails_52.gemfile +18 -0
  23. data/gemfiles/rails_60.gemfile +18 -0
  24. data/gemfiles/redis_40.gemfile +15 -0
  25. data/gemfiles/resque_122.gemfile +16 -0
  26. data/gemfiles/resque_20.gemfile +15 -0
  27. data/gemfiles/rest_client_16.gemfile +15 -0
  28. data/gemfiles/rest_client_20.gemfile +15 -0
  29. data/gemfiles/roda_20.gemfile +15 -0
  30. data/gemfiles/roda_30.gemfile +15 -0
  31. data/gemfiles/sidekiq_42.gemfile +15 -0
  32. data/gemfiles/sidekiq_50.gemfile +15 -0
  33. data/gemfiles/sinatra_14.gemfile +15 -0
  34. data/instana.gemspec +1 -7
  35. data/lib/instana/activator.rb +41 -0
  36. data/lib/instana/activators/action_controller_api.rb +18 -0
  37. data/lib/instana/activators/action_controller_base.rb +18 -0
  38. data/lib/instana/activators/action_view.rb +18 -0
  39. data/lib/instana/activators/active_record.rb +18 -0
  40. data/lib/instana/activators/cuba.rb +18 -0
  41. data/lib/instana/activators/dalli.rb +20 -0
  42. data/lib/instana/activators/excon.rb +17 -0
  43. data/lib/instana/activators/graphql.rb +19 -0
  44. data/lib/instana/activators/grpc_client.rb +17 -0
  45. data/lib/instana/activators/grpc_server.rb +17 -0
  46. data/lib/instana/activators/net_http.rb +17 -0
  47. data/lib/instana/activators/rack.rb +13 -0
  48. data/lib/instana/activators/rails.rb +15 -0
  49. data/lib/instana/activators/redis.rb +17 -0
  50. data/lib/instana/activators/resque_client.rb +18 -0
  51. data/lib/instana/activators/resque_worker.rb +30 -0
  52. data/lib/instana/activators/rest_client.rb +17 -0
  53. data/lib/instana/activators/roda.rb +18 -0
  54. data/lib/instana/activators/sidekiq_client.rb +21 -0
  55. data/lib/instana/activators/sidekiq_worker.rb +21 -0
  56. data/lib/instana/activators/sinatra.rb +18 -0
  57. data/lib/instana/config.rb +11 -0
  58. data/lib/instana/frameworks/cuba.rb +6 -13
  59. data/lib/instana/frameworks/rails.rb +20 -33
  60. data/lib/instana/frameworks/roda.rb +7 -13
  61. data/lib/instana/frameworks/sinatra.rb +1 -8
  62. data/lib/instana/instrumentation/action_controller.rb +81 -0
  63. data/lib/instana/instrumentation/action_view.rb +27 -0
  64. data/lib/instana/instrumentation/active_record.rb +47 -0
  65. data/lib/instana/instrumentation/dalli.rb +7 -18
  66. data/lib/instana/instrumentation/excon.rb +51 -57
  67. data/lib/instana/instrumentation/graphql.rb +75 -0
  68. data/lib/instana/instrumentation/grpc.rb +70 -66
  69. data/lib/instana/instrumentation/instrumented_request.rb +69 -0
  70. data/lib/instana/instrumentation/net-http.rb +43 -47
  71. data/lib/instana/instrumentation/rack.rb +14 -53
  72. data/lib/instana/instrumentation/redis.rb +10 -18
  73. data/lib/instana/instrumentation/resque.rb +14 -50
  74. data/lib/instana/instrumentation/rest-client.rb +2 -17
  75. data/lib/instana/instrumentation/sidekiq-client.rb +0 -9
  76. data/lib/instana/instrumentation/sidekiq-worker.rb +0 -9
  77. data/lib/instana/secrets.rb +7 -7
  78. data/lib/instana/setup.rb +3 -1
  79. data/lib/instana/tracer.rb +6 -0
  80. data/lib/instana/tracing/span.rb +14 -10
  81. data/lib/instana/util.rb +15 -69
  82. data/lib/instana/version.rb +1 -1
  83. data/test/activator_test.rb +27 -0
  84. data/test/frameworks/cuba_test.rb +38 -40
  85. data/test/frameworks/roda_test.rb +39 -41
  86. data/test/frameworks/sinatra_test.rb +61 -64
  87. data/test/instrumentation/excon_test.rb +1 -2
  88. data/test/instrumentation/graphql_test.rb +116 -0
  89. data/test/instrumentation/grpc_test.rb +2 -1
  90. data/test/instrumentation/{net-http_test.rb → net_http_test.rb} +1 -0
  91. data/test/instrumentation/rack_instrumented_request_test.rb +84 -0
  92. data/test/{frameworks → instrumentation}/rack_test.rb +32 -20
  93. data/test/{frameworks/rails/actioncontroller_test.rb → instrumentation/rails_action_controller_test.rb} +37 -21
  94. data/test/instrumentation/rails_action_view_test.rb +138 -0
  95. data/test/instrumentation/rails_active_record_test.rb +121 -0
  96. data/test/instrumentation/redis_test.rb +10 -0
  97. data/test/instrumentation/resque_test.rb +3 -11
  98. data/test/instrumentation/{rest-client_test.rb → rest_client_test.rb} +6 -0
  99. data/test/instrumentation/sidekiq-client_test.rb +1 -0
  100. data/test/instrumentation/sidekiq-worker_test.rb +1 -0
  101. data/test/support/apps/active_record/active_record.rb +21 -0
  102. data/test/{servers/grpc_50051.rb → support/apps/grpc/boot.rb} +1 -1
  103. data/test/{apps → support/apps/grpc}/grpc_server.rb +0 -0
  104. data/test/{servers/rackapp_6511.rb → support/apps/http_endpoint/boot.rb} +0 -0
  105. data/test/{servers/rails_3205.rb → support/apps/rails/boot.rb} +8 -14
  106. data/test/{models → support/apps/rails/models}/block.rb +1 -1
  107. data/test/{models → support/apps/rails/models}/block6.rb +0 -0
  108. data/test/support/apps/resque/boot.rb +2 -0
  109. data/test/{jobs → support/apps/resque/jobs}/resque_error_job.rb +0 -0
  110. data/test/{jobs → support/apps/resque/jobs}/resque_fast_job.rb +0 -0
  111. data/test/support/apps/sidekiq/boot.rb +21 -0
  112. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_1.rb +0 -0
  113. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_2.rb +0 -0
  114. data/test/{servers → support/apps}/sidekiq/worker.rb +2 -2
  115. data/test/support/helpers.rb +94 -0
  116. data/test/test_helper.rb +24 -144
  117. data/test/tracing/id_management_test.rb +4 -66
  118. metadata +106 -95
  119. data/gemfiles/libraries.gemfile +0 -71
  120. data/gemfiles/rails32.gemfile +0 -51
  121. data/gemfiles/rails42.gemfile +0 -50
  122. data/gemfiles/rails50.gemfile +0 -52
  123. data/gemfiles/rails52.gemfile +0 -52
  124. data/gemfiles/rails60.gemfile +0 -72
  125. data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +0 -58
  126. data/lib/instana/frameworks/instrumentation/action_controller.rb +0 -194
  127. data/lib/instana/frameworks/instrumentation/action_view.rb +0 -43
  128. data/lib/instana/frameworks/instrumentation/active_record.rb +0 -27
  129. data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +0 -81
  130. data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +0 -56
  131. data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +0 -85
  132. data/lib/instana/instrumentation.rb +0 -25
  133. data/lib/instana/test.rb +0 -43
  134. data/test/apps/cuba.rb +0 -19
  135. data/test/apps/roda.rb +0 -13
  136. data/test/apps/sinatra.rb +0 -9
  137. data/test/frameworks/rails/actionview3_test.rb +0 -210
  138. data/test/frameworks/rails/actionview4_test.rb +0 -208
  139. data/test/frameworks/rails/actionview5_test.rb +0 -221
  140. data/test/frameworks/rails/activerecord_test.rb +0 -227
  141. data/test/servers/helpers/sidekiq_worker_initializer.rb +0 -27
@@ -1,52 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group :development, :test do
4
- gem 'rake'
5
- gem 'minitest', '5.9.1'
6
- gem 'minitest-reporters'
7
- gem 'minitest-debugger', :require => false
8
- gem 'rack-test'
9
- gem 'webmock'
10
- gem 'puma'
11
- # public_suffix dropped support for Ruby 2.1 and earlier.
12
- gem 'public_suffix', '< 3.0'
13
- end
14
-
15
- group :development do
16
- gem 'ruby-debug', :platforms => [:mri_18, :jruby]
17
- gem 'debugger', :platform => :mri_19
18
-
19
- if RUBY_VERSION > '1.8.7'
20
- gem 'pry'
21
-
22
- if RUBY_VERSION < '2.2'
23
- gem 'byebug', '< 9.1.0'
24
- gem 'pry-byebug'
25
- else
26
- gem 'pry-byebug'
27
- end
28
- else
29
- gem 'pry', '0.9.12.4'
30
- end
31
- end
32
-
33
- gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
34
- gem 'sass-rails', '~> 5.0'
35
- gem 'uglifier', '>= 1.3.0'
36
- gem 'coffee-rails', '~> 4.2'
37
- #gem 'therubyracer', platforms: :ruby
38
-
39
- gem 'jquery-rails'
40
- gem 'turbolinks', '~> 5'
41
- gem 'jbuilder', '~> 2.5'
42
-
43
- gem 'pg'
44
- gem 'mysql2', '0.5.2'
45
-
46
- # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
47
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
48
-
49
- # Include the Instana Ruby gem's base set of gems
50
- gemspec :path => File.expand_path(File.dirname(__FILE__) + '/../')
51
-
52
- # vim:syntax=ruby
@@ -1,52 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group :development, :test do
4
- gem 'rake'
5
- gem 'minitest', '5.9.1'
6
- gem 'minitest-reporters'
7
- gem 'minitest-debugger', :require => false
8
- gem 'rack-test'
9
- gem 'webmock'
10
- gem 'puma'
11
- # public_suffix dropped support for Ruby 2.1 and earlier.
12
- gem 'public_suffix', '< 3.0'
13
- end
14
-
15
- group :development do
16
- gem 'ruby-debug', :platforms => [:mri_18, :jruby]
17
- gem 'debugger', :platform => :mri_19
18
-
19
- if RUBY_VERSION > '1.8.7'
20
- gem 'pry'
21
-
22
- if RUBY_VERSION < '2.2'
23
- gem 'byebug', '< 9.1.0'
24
- gem 'pry-byebug'
25
- else
26
- gem 'pry-byebug'
27
- end
28
- else
29
- gem 'pry', '0.9.12.4'
30
- end
31
- end
32
-
33
- gem 'rails', '~> 5.2'
34
- gem 'sass-rails', '~> 5.0'
35
- gem 'uglifier', '>= 1.3.0'
36
- gem 'coffee-rails', '~> 4.2'
37
- # gem 'therubyracer', platforms: :ruby
38
-
39
- gem 'jquery-rails'
40
- gem 'turbolinks', '~> 5'
41
- gem 'jbuilder', '~> 2.5'
42
-
43
- gem 'pg'
44
- gem 'mysql2', '0.4.10'
45
-
46
- # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
47
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
48
-
49
- # Include the Instana Ruby gem's base set of gems
50
- gemspec :path => File.expand_path(File.dirname(__FILE__) + '/../')
51
-
52
- # vim:syntax=ruby
@@ -1,72 +0,0 @@
1
- source 'https://rubygems.org'
2
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
-
4
- # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
- gem 'rails', '~> 6.0.2', '>= 6.0.2.1'
6
- # Use sqlite3 as the database for Active Record
7
- gem 'sqlite3', '~> 1.4'
8
- # Use Puma as the app server
9
- gem 'puma', '~> 4.1'
10
- # Use SCSS for stylesheets
11
- gem 'sass-rails', '>= 6'
12
- # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
13
- gem 'webpacker', '~> 4.0'
14
- # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
15
- gem 'turbolinks', '~> 5'
16
- # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
17
- gem 'jbuilder', '~> 2.7'
18
- # Use Redis adapter to run Action Cable in production
19
- # gem 'redis', '~> 4.0'
20
- # Use Active Model has_secure_password
21
- # gem 'bcrypt', '~> 3.1.7'
22
-
23
- gem 'mysql2', '0.4.10'
24
-
25
- # Use Active Storage variant
26
- # gem 'image_processing', '~> 1.2'
27
-
28
- # Reduces boot times through caching; required in config/boot.rb
29
- gem 'bootsnap', '>= 1.4.2', require: false
30
-
31
- group :development, :test do
32
- # Call 'byebug' anywhere in the code to stop execution and get a debugger console
33
- gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
34
- end
35
-
36
- group :development do
37
- # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
38
- gem 'web-console', '>= 3.3.0'
39
- gem 'listen', '>= 3.0.5', '< 3.2'
40
- # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
41
- gem 'spring'
42
- gem 'spring-watcher-listen', '~> 2.0.0'
43
- end
44
-
45
- group :test do
46
- # Adds support for Capybara system testing and selenium driver
47
- gem 'capybara', '>= 2.15'
48
- gem 'selenium-webdriver'
49
- # Easy installation and use of web drivers to run system tests with browsers
50
- gem 'webdrivers'
51
- end
52
-
53
- group :development, :test do
54
- gem 'rake'
55
- gem 'minitest', '5.9.1'
56
- gem 'minitest-reporters'
57
- gem 'minitest-debugger', :require => false
58
- gem 'rack-test'
59
- gem 'webmock'
60
- # public_suffix dropped support for Ruby 2.1 and earlier.
61
- gem 'public_suffix', '< 3.0'
62
- end
63
-
64
-
65
- # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
66
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
67
-
68
- # Include the Instana Ruby gem's base set of gems
69
- gemspec :path => File.expand_path(File.dirname(__FILE__) + '/../')
70
-
71
-
72
- # vim:syntax=ruby
@@ -1,58 +0,0 @@
1
- module Instana
2
- module Instrumentation
3
- module AbstractMysqlAdapter
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.included(klass)
10
- if ActiveRecord::VERSION::STRING >= '3.2'
11
- Instana::Util.method_alias(klass, :execute)
12
-
13
- @@sanitize_regexp = Regexp.new('(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)', Regexp::IGNORECASE)
14
- end
15
- end
16
-
17
- # Collect up this DB connection info for reporting.
18
- #
19
- # @param sql [String]
20
- # @return [Hash] Hash of collected KVs
21
- #
22
- def collect(sql)
23
- payload = { :activerecord => {} }
24
- payload[:activerecord][:sql] = sql.gsub(@@sanitize_regexp, '?')
25
- payload[:activerecord][:adapter] = @config[:adapter]
26
- payload[:activerecord][:host] = @config[:host]
27
- payload[:activerecord][:db] = @config[:database]
28
- payload[:activerecord][:username] = @config[:username]
29
- payload
30
- end
31
-
32
- # In the spirit of ::ActiveRecord::ExplainSubscriber.ignore_payload? There are
33
- # only certain calls that we're interested in tracing. e.g. No use to instrument
34
- # framework caches.
35
- #
36
- # @param payload [String]
37
- # @return [Boolean]
38
- #
39
- def ignore_payload?(name, sql)
40
- IGNORED_PAYLOADS.include?(name) || sql !~ EXPLAINED_SQLS
41
- end
42
-
43
- def execute_with_instana(sql, name = nil)
44
- tracing = ::Instana.tracer.tracing?
45
- if !tracing || ignore_payload?(name, sql)
46
- return execute_without_instana(sql, name)
47
- elsif ::Instana.tracer.current_span[:n] == :activerecord
48
- return execute_without_instana(sql, name)
49
- end
50
-
51
- kv_payload = collect(sql)
52
- ::Instana.tracer.trace(:activerecord, kv_payload) do
53
- execute_without_instana(sql, name)
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,194 +0,0 @@
1
- module Instana
2
- module Instrumentation
3
-
4
- # Contains the methods common to both ::Instana::Instrumentation::ActionController
5
- # and ::Instana::Instrumentation::ActionControllerLegacy
6
- #
7
- module ActionControllerCommon
8
-
9
- # Indicates whether a Controller rescue handler is in place. If so, this affects
10
- # error logging and reporting. (Hence the need for this method).
11
- #
12
- # @return [Boolean]
13
- #
14
- def has_rails_handler?(exception)
15
- found = false
16
- rescue_handlers.detect do |klass_name, _handler|
17
- # Rescue handlers can be specified as strings or constant names
18
- klass = self.class.const_get(klass_name) rescue nil
19
- klass ||= klass_name.constantize rescue nil
20
- found = exception.is_a?(klass) if klass
21
- end
22
- found
23
- rescue => e
24
- ::Instana.logger.debug { "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" }
25
- return false
26
- end
27
-
28
- # Render can be called with many options across the various supported
29
- # versions of Rails. This method attempts to make sense and provide
30
- # insight into what is happening (rendering a layout, file, nothing,
31
- # plaintext etc.)
32
- def get_render_topic(opts)
33
- if opts.key?(:layout)
34
- case opts[:layout]
35
- when FalseClass
36
- name = "Without layout"
37
- when String
38
- name = opts[:layout]
39
- when Proc
40
- name = "Proc"
41
- else
42
- name = "Default"
43
- end
44
- end
45
-
46
- return name if name
47
-
48
- if opts.key?(:template)
49
- name ||= opts[:template]
50
- elsif opts.key?(:file)
51
- name ||= opts[:file]
52
- elsif opts.key?(:nothing)
53
- name = "Nothing"
54
- elsif opts.key?(:plain)
55
- name = "Plaintext"
56
- elsif opts.key?(:json)
57
- name = "JSON"
58
- elsif opts.key?(:xml)
59
- name = "XML"
60
- elsif opts.key?(:body)
61
- name = "Raw"
62
- elsif opts.key?(:js)
63
- name = "Javascript"
64
- end
65
- name
66
- end
67
-
68
- def matched_path_template
69
- Rails.application.routes.router.recognize(request) do |route, _, _|
70
- path = route.path
71
- return path.spec.to_s
72
- end
73
-
74
- nil
75
- end
76
- end
77
-
78
- # Used in ActionPack versions 5 and beyond, this module provides
79
- # instrumentation for ActionController (a part of ActionPack)
80
- #
81
- module ActionController
82
- include ::Instana::Instrumentation::ActionControllerCommon
83
-
84
- # This is the Rails 5 version of the process_action method where we use prepend to
85
- # instrument the class method instead of using the older alias_method_chain.
86
- #
87
- def process_action(*args)
88
- kv_payload = { :actioncontroller => {} }
89
- kv_payload[:actioncontroller][:controller] = self.class.name
90
- kv_payload[:actioncontroller][:action] = action_name
91
-
92
- ::Instana.tracer.log_entry(:actioncontroller, kv_payload)
93
-
94
- super(*args)
95
- request.env['INSTANA_HTTP_PATH_TEMPLATE'] = matched_path_template
96
- rescue Exception => e
97
- ::Instana.tracer.log_error(e) unless has_rails_handler?(e)
98
- raise
99
- ensure
100
- ::Instana.tracer.log_exit(:actioncontroller)
101
- end
102
-
103
- # The Instana wrapper method for ActionController::Base.render
104
- # for versions 5+.
105
- #
106
- def render(*args, &blk)
107
- # Figure out what's being rendered
108
- if args.length > 0 && args[0].is_a?(Hash)
109
- name = get_render_topic(args[0])
110
- end
111
- name ||= "Default"
112
-
113
- ::Instana.tracer.log_entry(:actionview, :actionview => { :name => name })
114
-
115
- super(*args, &blk)
116
- rescue Exception => e
117
- ::Instana.tracer.log_error(e) unless has_rails_handler?(e)
118
- raise
119
- ensure
120
- ::Instana.tracer.log_exit(:actionview)
121
- end
122
- end
123
-
124
- # Used in ActionPack versions 4 and earlier, this module provides
125
- # instrumentation for ActionController (a part of ActionPack)
126
- #
127
- module ActionControllerLegacy
128
- include ::Instana::Instrumentation::ActionControllerCommon
129
-
130
- def self.included(klass)
131
- klass.class_eval do
132
- alias_method_chain :process_action, :instana
133
- alias_method_chain :render, :instana
134
- end
135
- end
136
-
137
- # The Instana wrapper method for ActionController::Base.process_action
138
- # for versions 3 and 4.
139
- #
140
- def process_action_with_instana(*args)
141
- kv_payload = { :actioncontroller => {} }
142
- kv_payload[:actioncontroller][:controller] = self.class.name
143
- kv_payload[:actioncontroller][:action] = action_name
144
-
145
- ::Instana.tracer.log_entry(:actioncontroller, kv_payload)
146
-
147
- process_action_without_instana(*args)
148
- request.env['INSTANA_HTTP_PATH_TEMPLATE'] = matched_path_template
149
- rescue Exception => e
150
- ::Instana.tracer.log_error(e) unless has_rails_handler?(e)
151
- raise
152
- ensure
153
- ::Instana.tracer.log_exit(:actioncontroller)
154
- end
155
-
156
- # The Instana wrapper method for ActionController::Base.render
157
- # for versions 3 and 4.
158
- #
159
- def render_with_instana(*args, &blk)
160
- if args.length > 0 && args[0].is_a?(Hash)
161
- name = get_render_topic(args[0])
162
- end
163
- name ||= "Default"
164
- ::Instana.tracer.log_entry(:actionview, :actionview => { :name => name })
165
- render_without_instana(*args, &blk)
166
- rescue Exception => e
167
- ::Instana.tracer.log_error(e) unless has_rails_handler?(e)
168
- raise
169
- ensure
170
- ::Instana.tracer.log_exit(:actionview)
171
- end
172
- end
173
- end
174
- end
175
-
176
- if defined?(::ActionController) && ::Instana.config[:action_controller][:enabled] && ::ActionPack::VERSION::MAJOR >= 2
177
- ::Instana.logger.debug "Instrumenting ActionController"
178
- if ActionPack::VERSION::MAJOR >= 5
179
- ::ActionController::Base.send(:prepend, ::Instana::Instrumentation::ActionController)
180
- else
181
- ::ActionController::Base.send(:include, ::Instana::Instrumentation::ActionControllerLegacy)
182
- end
183
- end
184
-
185
- # ActionController::API was introduced in Ruby on Rails 5 but was originally an independent project before being
186
- # rolled into the Rails ActionPack. In case, someone is using the independent project or potentially backported
187
- # the rails version to and older Ruby on Rails version, we only limit in a minimal way re: version checking.
188
- #
189
- # We allow ActionController::API instrumentation in version of Ruby on Rails 3 and higher.
190
- #
191
- if defined?(::ActionController::API) && ::Instana.config[:action_controller][:enabled] && ::ActionPack::VERSION::MAJOR >= 3
192
- ::Instana.logger.debug "Instrumenting ActionController API"
193
- ::ActionController::API.send(:prepend, ::Instana::Instrumentation::ActionController)
194
- end
@@ -1,43 +0,0 @@
1
- module Instana
2
- module Instrumentation
3
- module ActionViewRenderer
4
- def self.included(klass)
5
- ::Instana::Util.method_alias(klass, :render_partial)
6
- ::Instana::Util.method_alias(klass, :render_collection)
7
- end
8
-
9
- def render_partial_with_instana(*args)
10
- kv_payload = { :render => {} }
11
- kv_payload[:render][:type] = :partial
12
- kv_payload[:render][:name] = @options[:partial].to_s if @options.is_a?(Hash)
13
-
14
- ::Instana.tracer.log_entry(:render, kv_payload)
15
- render_partial_without_instana(*args)
16
- rescue Exception => e
17
- ::Instana.tracer.log_error(e)
18
- raise
19
- ensure
20
- ::Instana.tracer.log_exit(:render)
21
- end
22
-
23
- def render_collection_with_instana(*args)
24
- kv_payload = { :render => {} }
25
- kv_payload[:render][:type] = :collection
26
- kv_payload[:render][:name] = @path.to_s
27
-
28
- ::Instana.tracer.log_entry(:render, kv_payload)
29
- render_collection_without_instana(*args)
30
- rescue Exception => e
31
- ::Instana.tracer.log_error(e)
32
- raise
33
- ensure
34
- ::Instana.tracer.log_exit(:render)
35
- end
36
- end
37
- end
38
- end
39
-
40
- if defined?(::ActionView) && ::Instana.config[:action_view][:enabled] && ::ActionPack::VERSION::STRING >= '3.1'
41
- ::Instana.logger.debug "Instrumenting ActionView"
42
- ::ActionView::PartialRenderer.send(:include, ::Instana::Instrumentation::ActionViewRenderer)
43
- end