instana 1.11.8 → 1.193.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +10 -0
- data/Rakefile +26 -37
- data/gemfiles/libraries.gemfile +2 -0
- data/lib/instana/agent.rb +6 -0
- data/lib/instana/base.rb +2 -0
- data/lib/instana/config.rb +11 -0
- data/lib/instana/frameworks/cuba.rb +33 -0
- data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +5 -7
- data/lib/instana/frameworks/instrumentation/action_controller.rb +11 -0
- data/lib/instana/frameworks/instrumentation/action_view.rb +6 -10
- data/lib/instana/frameworks/instrumentation/active_record.rb +4 -4
- data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +17 -15
- data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +11 -7
- data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +33 -19
- data/lib/instana/frameworks/roda.rb +41 -0
- data/lib/instana/frameworks/sinatra.rb +17 -0
- data/lib/instana/instrumentation/dalli.rb +9 -14
- data/lib/instana/instrumentation/excon.rb +1 -1
- data/lib/instana/instrumentation/graphql.rb +77 -0
- data/lib/instana/instrumentation/grpc.rb +72 -62
- data/lib/instana/instrumentation/instrumented_request.rb +68 -0
- data/lib/instana/instrumentation/net-http.rb +44 -43
- data/lib/instana/instrumentation/rack.rb +17 -52
- data/lib/instana/instrumentation/redis.rb +15 -18
- data/lib/instana/instrumentation/resque.rb +17 -28
- data/lib/instana/instrumentation/rest-client.rb +3 -13
- data/lib/instana/secrets.rb +42 -0
- data/lib/instana/setup.rb +1 -0
- data/lib/instana/tracer.rb +6 -0
- data/lib/instana/tracing/span.rb +14 -10
- data/lib/instana/util.rb +15 -69
- data/lib/instana/version.rb +1 -1
- data/test/apps/cuba.rb +4 -0
- data/test/apps/roda.rb +3 -0
- data/test/apps/sinatra.rb +4 -0
- data/test/config_test.rb +1 -17
- data/test/frameworks/cuba_test.rb +14 -1
- data/test/frameworks/rack_test.rb +52 -19
- data/test/frameworks/rails/actioncontroller_test.rb +12 -0
- data/test/frameworks/rails/activerecord_test.rb +80 -28
- data/test/frameworks/roda_test.rb +14 -0
- data/test/frameworks/sinatra_test.rb +14 -0
- data/test/instrumentation/excon_test.rb +0 -2
- data/test/instrumentation/graphql_test.rb +116 -0
- data/test/instrumentation/instrumented_request_test.rb +84 -0
- data/test/instrumentation/redis_test.rb +10 -0
- data/test/secrets_test.rb +73 -0
- data/test/test_helper.rb +3 -9
- data/test/tracing/id_management_test.rb +4 -66
- metadata +16 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26ea11d0efe2f26610441700b71bc9c2abd4192566a86d00089d1e889d8457d3
|
4
|
+
data.tar.gz: 5dde944418b1f34391c08114692b4f34d27acc8328e0d7bd47c7b14834e21d61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11c700d01ab267b978d527dd9fcc993b5ae19bb659074690ced25b12f34d1b58c850c241776b3c8932a274138170d885e7f9a0c28b430bc382a81c0df3b99451
|
7
|
+
data.tar.gz: 8e4dd40a1d9f87e00905eca337189870f3e8237ce33b3be80853d85e7b11667243fe1e5ca7c6e126b492e0c2ba5d404257bfa908e50984f40d184a65f1067239
|
data/.editorconfig
ADDED
data/Rakefile
CHANGED
@@ -8,44 +8,33 @@ Rake::TestTask.new(:test) do |t|
|
|
8
8
|
|
9
9
|
t.libs << "test"
|
10
10
|
t.libs << "lib"
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
'test/frameworks/sinatra_test.rb']
|
37
|
-
else
|
38
|
-
t.test_files = FileList['test/agent/*_test.rb'] +
|
39
|
-
FileList['test/tracing/*_test.rb'] +
|
40
|
-
FileList['test/profiling/*_test.rb'] +
|
41
|
-
FileList['test/benchmarks/bench_*.rb']
|
42
|
-
end
|
43
|
-
else
|
44
|
-
t.test_files = FileList['test/agent/*_test.rb'] +
|
45
|
-
FileList['test/tracing/*_test.rb'] +
|
46
|
-
FileList['test/profiling/*_test.rb'] +
|
47
|
-
FileList['test/benchmarks/bench_*.rb']
|
11
|
+
|
12
|
+
t.test_files = Dir[
|
13
|
+
'test/*_test.rb',
|
14
|
+
'test/{agent,tracing,profiling,benchmarks}/*_test.rb'
|
15
|
+
]
|
16
|
+
|
17
|
+
case File.basename(ENV.fetch('BUNDLE_GEMFILE', '')).split('.').first
|
18
|
+
when /rails6/
|
19
|
+
t.test_files = %w(test/frameworks/rails/activerecord_test.rb
|
20
|
+
test/frameworks/rails/actioncontroller_test.rb
|
21
|
+
test/frameworks/rails/actionview5_test.rb)
|
22
|
+
when /rails5/
|
23
|
+
t.test_files = %w(test/frameworks/rails/activerecord_test.rb
|
24
|
+
test/frameworks/rails/actioncontroller_test.rb
|
25
|
+
test/frameworks/rails/actionview5_test.rb)
|
26
|
+
when /rails42/
|
27
|
+
t.test_files = %w(test/frameworks/rails/activerecord_test.rb
|
28
|
+
test/frameworks/rails/actioncontroller_test.rb
|
29
|
+
test/frameworks/rails/actionview4_test.rb)
|
30
|
+
when /rails32/
|
31
|
+
t.test_files = %w(test/frameworks/rails/activerecord_test.rb
|
32
|
+
test/frameworks/rails/actioncontroller_test.rb
|
33
|
+
test/frameworks/rails/actionview3_test.rb)
|
34
|
+
when /libraries/
|
35
|
+
t.test_files = Dir['test/{instrumentation,frameworks}/*_test.rb']
|
48
36
|
end
|
37
|
+
|
49
38
|
end
|
50
39
|
|
51
40
|
task :environment do
|
data/gemfiles/libraries.gemfile
CHANGED
data/lib/instana/agent.rb
CHANGED
@@ -25,6 +25,7 @@ module Instana
|
|
25
25
|
attr_accessor :collect_thread
|
26
26
|
attr_accessor :thread_spawn_lock
|
27
27
|
attr_accessor :extra_headers
|
28
|
+
attr_reader :secret_values
|
28
29
|
|
29
30
|
attr_accessor :testmode
|
30
31
|
|
@@ -83,6 +84,10 @@ module Instana
|
|
83
84
|
|
84
85
|
# The agent may pass down custom headers for this sensor to capture
|
85
86
|
@extra_headers = nil
|
87
|
+
|
88
|
+
# The values considered sensitive and removed from http query parameters
|
89
|
+
# and database connection strings
|
90
|
+
@secret_values = nil
|
86
91
|
end
|
87
92
|
|
88
93
|
# Spawns the background thread and calls start. This method is separated
|
@@ -278,6 +283,7 @@ module Instana
|
|
278
283
|
data = Oj.load(response.body, OJ_OPTIONS)
|
279
284
|
@process[:report_pid] = data['pid']
|
280
285
|
@agent_uuid = data['agentUuid']
|
286
|
+
@secret_values = data['secrets']
|
281
287
|
|
282
288
|
if data.key?('extraHeaders')
|
283
289
|
@extra_headers = data['extraHeaders']
|
data/lib/instana/base.rb
CHANGED
@@ -12,6 +12,7 @@ module Instana
|
|
12
12
|
attr_accessor :config
|
13
13
|
attr_accessor :logger
|
14
14
|
attr_accessor :pid
|
15
|
+
attr_reader :secrets
|
15
16
|
|
16
17
|
##
|
17
18
|
# setup
|
@@ -24,6 +25,7 @@ module Instana
|
|
24
25
|
@tracer = ::Instana::Tracer.new
|
25
26
|
@processor = ::Instana::Processor.new
|
26
27
|
@collector = ::Instana::Collector.new
|
28
|
+
@secrets = ::Instana::Secrets.new
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
data/lib/instana/config.rb
CHANGED
@@ -42,12 +42,23 @@ module Instana
|
|
42
42
|
# ::Instana.config[:collect_backtraces] = true
|
43
43
|
@config[:collect_backtraces] = false
|
44
44
|
|
45
|
+
# By default, collected SQL will be sanitized to remove potentially sensitive bind params such as:
|
46
|
+
# > SELECT "blocks".* FROM "blocks" WHERE "blocks"."name" = "Mr. Smith"
|
47
|
+
#
|
48
|
+
# ...would be sanitized to be:
|
49
|
+
# > SELECT "blocks".* FROM "blocks" WHERE "blocks"."name" = ?
|
50
|
+
#
|
51
|
+
# This sanitization step can be disabled by setting the following value to false.
|
52
|
+
# ::Instana.config[:sanitize_sql] = false
|
53
|
+
@config[:sanitize_sql] = true
|
54
|
+
|
45
55
|
@config[:action_controller] = { :enabled => true }
|
46
56
|
@config[:action_view] = { :enabled => true }
|
47
57
|
@config[:active_record] = { :enabled => true }
|
48
58
|
@config[:dalli] = { :enabled => true }
|
49
59
|
@config[:excon] = { :enabled => true }
|
50
60
|
@config[:grpc] = { :enabled => true }
|
61
|
+
@config[:graphql] = { :enabled => true }
|
51
62
|
@config[:nethttp] = { :enabled => true }
|
52
63
|
@config[:redis] = { :enabled => true }
|
53
64
|
@config[:'resque-client'] = { :enabled => true }
|
@@ -1,6 +1,39 @@
|
|
1
1
|
require "instana/rack"
|
2
2
|
|
3
|
+
module Instana
|
4
|
+
module CubaPathTemplateExtractor
|
5
|
+
REPLACE_TARGET = /:(?<term>[^\/]+)/i
|
6
|
+
|
7
|
+
def self.prepended(base)
|
8
|
+
::Instana.logger.debug "#{base} prepended #{self}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def on(*args, &blk)
|
12
|
+
wrapper = lambda do |*caputres|
|
13
|
+
env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] << args
|
14
|
+
.select { |a| a.is_a?(String) }
|
15
|
+
.join('/')
|
16
|
+
|
17
|
+
blk.call(*captures)
|
18
|
+
end
|
19
|
+
|
20
|
+
super(*args, &wrapper)
|
21
|
+
end
|
22
|
+
|
23
|
+
def call!(env)
|
24
|
+
env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] = []
|
25
|
+
response = super(env)
|
26
|
+
env['INSTANA_HTTP_PATH_TEMPLATE'] = env['INSTANA_PATH_TEMPLATE_FRAGMENTS']
|
27
|
+
.join('/')
|
28
|
+
.gsub(REPLACE_TARGET, '{\k<term>}')
|
29
|
+
response
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
3
35
|
if defined?(::Cuba)
|
4
36
|
::Instana.logger.debug "Instrumenting Cuba"
|
5
37
|
Cuba.use ::Instana::Rack
|
38
|
+
Cuba.prepend ::Instana::CubaPathTemplateExtractor
|
6
39
|
end
|
@@ -6,10 +6,8 @@ module Instana
|
|
6
6
|
|
7
7
|
# This module supports instrumenting ActiveRecord with the mysql2 adapter.
|
8
8
|
#
|
9
|
-
def self.
|
9
|
+
def self.prepended(klass)
|
10
10
|
if ActiveRecord::VERSION::STRING >= '3.2'
|
11
|
-
Instana::Util.method_alias(klass, :execute)
|
12
|
-
|
13
11
|
@@sanitize_regexp = Regexp.new('(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)', Regexp::IGNORECASE)
|
14
12
|
end
|
15
13
|
end
|
@@ -40,17 +38,17 @@ module Instana
|
|
40
38
|
IGNORED_PAYLOADS.include?(name) || sql !~ EXPLAINED_SQLS
|
41
39
|
end
|
42
40
|
|
43
|
-
def
|
41
|
+
def execute(sql, name = nil)
|
44
42
|
tracing = ::Instana.tracer.tracing?
|
45
43
|
if !tracing || ignore_payload?(name, sql)
|
46
|
-
return
|
44
|
+
return super(sql, name)
|
47
45
|
elsif ::Instana.tracer.current_span[:n] == :activerecord
|
48
|
-
return
|
46
|
+
return super(sql, name)
|
49
47
|
end
|
50
48
|
|
51
49
|
kv_payload = collect(sql)
|
52
50
|
::Instana.tracer.trace(:activerecord, kv_payload) do
|
53
|
-
|
51
|
+
super(sql, name)
|
54
52
|
end
|
55
53
|
end
|
56
54
|
end
|
@@ -64,6 +64,15 @@ module Instana
|
|
64
64
|
end
|
65
65
|
name
|
66
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
|
67
76
|
end
|
68
77
|
|
69
78
|
# Used in ActionPack versions 5 and beyond, this module provides
|
@@ -83,6 +92,7 @@ module Instana
|
|
83
92
|
::Instana.tracer.log_entry(:actioncontroller, kv_payload)
|
84
93
|
|
85
94
|
super(*args)
|
95
|
+
request.env['INSTANA_HTTP_PATH_TEMPLATE'] = matched_path_template
|
86
96
|
rescue Exception => e
|
87
97
|
::Instana.tracer.log_error(e) unless has_rails_handler?(e)
|
88
98
|
raise
|
@@ -135,6 +145,7 @@ module Instana
|
|
135
145
|
::Instana.tracer.log_entry(:actioncontroller, kv_payload)
|
136
146
|
|
137
147
|
process_action_without_instana(*args)
|
148
|
+
request.env['INSTANA_HTTP_PATH_TEMPLATE'] = matched_path_template
|
138
149
|
rescue Exception => e
|
139
150
|
::Instana.tracer.log_error(e) unless has_rails_handler?(e)
|
140
151
|
raise
|
@@ -1,18 +1,13 @@
|
|
1
1
|
module Instana
|
2
2
|
module Instrumentation
|
3
3
|
module ActionViewRenderer
|
4
|
-
def
|
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)
|
4
|
+
def render_partial(*args)
|
10
5
|
kv_payload = { :render => {} }
|
11
6
|
kv_payload[:render][:type] = :partial
|
12
7
|
kv_payload[:render][:name] = @options[:partial].to_s if @options.is_a?(Hash)
|
13
8
|
|
14
9
|
::Instana.tracer.log_entry(:render, kv_payload)
|
15
|
-
|
10
|
+
super(*args)
|
16
11
|
rescue Exception => e
|
17
12
|
::Instana.tracer.log_error(e)
|
18
13
|
raise
|
@@ -20,13 +15,14 @@ module Instana
|
|
20
15
|
::Instana.tracer.log_exit(:render)
|
21
16
|
end
|
22
17
|
|
23
|
-
def
|
18
|
+
def render_collection(*args)
|
19
|
+
puts 'called'
|
24
20
|
kv_payload = { :render => {} }
|
25
21
|
kv_payload[:render][:type] = :collection
|
26
22
|
kv_payload[:render][:name] = @path.to_s
|
27
23
|
|
28
24
|
::Instana.tracer.log_entry(:render, kv_payload)
|
29
|
-
|
25
|
+
super(*args)
|
30
26
|
rescue Exception => e
|
31
27
|
::Instana.tracer.log_error(e)
|
32
28
|
raise
|
@@ -39,5 +35,5 @@ end
|
|
39
35
|
|
40
36
|
if defined?(::ActionView) && ::Instana.config[:action_view][:enabled] && ::ActionPack::VERSION::STRING >= '3.1'
|
41
37
|
::Instana.logger.debug "Instrumenting ActionView"
|
42
|
-
::ActionView::PartialRenderer.send(:
|
38
|
+
::ActionView::PartialRenderer.send(:prepend, ::Instana::Instrumentation::ActionViewRenderer)
|
43
39
|
end
|
@@ -9,19 +9,19 @@ if defined?(::ActiveRecord) && ::Instana.config[:active_record][:enabled]
|
|
9
9
|
# Mysql
|
10
10
|
if defined?(ActiveRecord::ConnectionAdapters::MysqlAdapter)
|
11
11
|
::Instana.logger.debug "Instrumenting ActiveRecord (mysql)"
|
12
|
-
ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:
|
13
|
-
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.send(:
|
12
|
+
ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:prepend, ::Instana::Instrumentation::MysqlAdapter)
|
13
|
+
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.send(:prepend, ::Instana::Instrumentation::AbstractMysqlAdapter)
|
14
14
|
end
|
15
15
|
|
16
16
|
# Mysql2
|
17
17
|
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
|
18
18
|
::Instana.logger.debug "Instrumenting ActiveRecord (mysql2)"
|
19
|
-
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:
|
19
|
+
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:prepend, ::Instana::Instrumentation::Mysql2Adapter)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Postgres
|
23
23
|
if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
24
24
|
::Instana.logger.debug "Instrumenting ActiveRecord (postgresql)"
|
25
|
-
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:
|
25
|
+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:prepend, ::Instana::Instrumentation::PostgreSQLAdapter)
|
26
26
|
end
|
27
27
|
end
|
@@ -6,13 +6,9 @@ module Instana
|
|
6
6
|
|
7
7
|
# This module supports instrumenting ActiveRecord with the mysql2 adapter.
|
8
8
|
#
|
9
|
-
def self.
|
9
|
+
def self.prepended(klass)
|
10
10
|
# ActiveRecord 3.1 and up only (for now possibly)
|
11
11
|
if ActiveRecord::VERSION::STRING > '3.0'
|
12
|
-
Instana::Util.method_alias(klass, :exec_delete)
|
13
|
-
Instana::Util.method_alias(klass, :exec_insert)
|
14
|
-
Instana::Util.method_alias(klass, :exec_query)
|
15
|
-
|
16
12
|
@@sanitize_regexp = Regexp.new('(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)', Regexp::IGNORECASE)
|
17
13
|
end
|
18
14
|
end
|
@@ -24,7 +20,13 @@ module Instana
|
|
24
20
|
#
|
25
21
|
def collect(sql)
|
26
22
|
payload = { :activerecord => {} }
|
27
|
-
|
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
|
+
|
28
30
|
payload[:activerecord][:adapter] = @config[:adapter]
|
29
31
|
payload[:activerecord][:host] = @config[:host]
|
30
32
|
payload[:activerecord][:db] = @config[:database]
|
@@ -43,37 +45,37 @@ module Instana
|
|
43
45
|
IGNORED_PAYLOADS.include?(name) || sql !~ EXPLAINED_SQLS
|
44
46
|
end
|
45
47
|
|
46
|
-
def
|
48
|
+
def exec_delete(sql, name = nil, binds = [])
|
47
49
|
if !::Instana.tracer.tracing? || ignore_payload?(name, sql)
|
48
|
-
return
|
50
|
+
return super(sql, name, binds)
|
49
51
|
end
|
50
52
|
|
51
53
|
kv_payload = collect(sql)
|
52
54
|
::Instana.tracer.trace(:activerecord, kv_payload) do
|
53
|
-
|
55
|
+
super(sql, name, binds)
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
|
-
def
|
59
|
+
def exec_insert(sql, name = 'SQL', binds = [], *args)
|
58
60
|
if !::Instana.tracer.tracing? || ignore_payload?(name, sql)
|
59
|
-
return
|
61
|
+
return super(sql, name, binds, *args)
|
60
62
|
end
|
61
63
|
|
62
64
|
kv_payload = collect(sql)
|
63
65
|
::Instana.tracer.trace(:activerecord, kv_payload) do
|
64
|
-
|
66
|
+
super(sql, name, binds, *args)
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
68
|
-
def
|
70
|
+
def exec_query(sql, name = 'SQL', binds = [], *args)
|
69
71
|
if !::Instana.tracer.tracing? || ignore_payload?(name, sql) ||
|
70
72
|
::Instana.tracer.current_span[:n] == :activerecord
|
71
|
-
return
|
73
|
+
return super(sql, name, binds, *args)
|
72
74
|
end
|
73
75
|
|
74
76
|
kv_payload = collect(sql)
|
75
77
|
::Instana.tracer.trace(:activerecord, kv_payload) do
|
76
|
-
|
78
|
+
super(sql, name, binds, *args)
|
77
79
|
end
|
78
80
|
end
|
79
81
|
end
|
@@ -6,10 +6,8 @@ module Instana
|
|
6
6
|
|
7
7
|
# This module supports instrumenting ActiveRecord with the mysql2 adapter.
|
8
8
|
#
|
9
|
-
def self.
|
9
|
+
def self.prepended(klass)
|
10
10
|
if ActiveRecord::VERSION::STRING >= '3.2'
|
11
|
-
Instana::Util.method_alias(klass, :exec_query)
|
12
|
-
|
13
11
|
@@sanitize_regexp = Regexp.new('(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)', Regexp::IGNORECASE)
|
14
12
|
end
|
15
13
|
end
|
@@ -21,7 +19,13 @@ module Instana
|
|
21
19
|
#
|
22
20
|
def collect(sql)
|
23
21
|
payload = { :activerecord => {} }
|
24
|
-
|
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
|
+
|
25
29
|
payload[:activerecord][:adapter] = @config[:adapter]
|
26
30
|
payload[:activerecord][:host] = @config[:host]
|
27
31
|
payload[:activerecord][:db] = @config[:database]
|
@@ -40,15 +44,15 @@ module Instana
|
|
40
44
|
IGNORED_PAYLOADS.include?(name) || sql !~ EXPLAINED_SQLS
|
41
45
|
end
|
42
46
|
|
43
|
-
def
|
47
|
+
def exec_query(sql, name = 'SQL', binds = [], *args)
|
44
48
|
if !::Instana.tracer.tracing? || ignore_payload?(name, sql) ||
|
45
49
|
::Instana.tracer.current_span[:n] == :activerecord
|
46
|
-
return
|
50
|
+
return super(sql, name, binds, *args)
|
47
51
|
end
|
48
52
|
|
49
53
|
kv_payload = collect(sql)
|
50
54
|
::Instana.tracer.trace(:activerecord, kv_payload) do
|
51
|
-
|
55
|
+
super(sql, name, binds, *args)
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|