instana 1.192.1 → 1.193.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +200 -133
- data/.gitignore +3 -0
- data/.rubocop.yml +10 -1145
- data/.rubocop_todo.yml +1140 -0
- data/Appraisals +103 -0
- data/Gemfile +14 -32
- data/LICENSE +2 -1
- data/Rakefile +19 -39
- data/benchmarks/10k-rack-traces.rb +3 -0
- data/benchmarks/Gemfile +4 -0
- data/benchmarks/id_generation.rb +4 -0
- data/benchmarks/opentracing.rb +4 -0
- data/benchmarks/rack_vanilla_vs_traced.rb +3 -0
- data/benchmarks/stackprof_rack_tracing.rb +3 -0
- data/benchmarks/time_processing.rb +4 -0
- data/bin/console +8 -4
- data/examples/opentracing.rb +4 -0
- data/examples/tracing.rb +4 -0
- data/extras/license_header.rb +44 -0
- data/gemfiles/.bundle/config +1 -2
- data/gemfiles/cuba_30.gemfile +18 -0
- data/gemfiles/dalli_20.gemfile +18 -0
- data/gemfiles/excon_02.gemfile +18 -0
- data/gemfiles/graphql_10.gemfile +18 -0
- data/gemfiles/grpc_10.gemfile +18 -0
- data/gemfiles/net_http_01.gemfile +17 -0
- data/gemfiles/rack_16.gemfile +18 -0
- data/gemfiles/rack_20.gemfile +18 -0
- data/gemfiles/rails_42.gemfile +21 -0
- data/gemfiles/rails_50.gemfile +21 -0
- data/gemfiles/rails_52.gemfile +21 -0
- data/gemfiles/rails_60.gemfile +21 -0
- data/gemfiles/redis_40.gemfile +18 -0
- data/gemfiles/resque_122.gemfile +19 -0
- data/gemfiles/resque_20.gemfile +18 -0
- data/gemfiles/rest_client_16.gemfile +18 -0
- data/gemfiles/rest_client_20.gemfile +18 -0
- data/gemfiles/roda_20.gemfile +18 -0
- data/gemfiles/roda_30.gemfile +18 -0
- data/gemfiles/sidekiq_42.gemfile +18 -0
- data/gemfiles/sidekiq_50.gemfile +18 -0
- data/gemfiles/sinatra_14.gemfile +18 -0
- data/instana.gemspec +5 -7
- data/lib/instana.rb +3 -0
- data/lib/instana/activator.rb +44 -0
- data/lib/instana/activators/action_cable.rb +24 -0
- data/lib/instana/activators/action_controller_api.rb +21 -0
- data/lib/instana/activators/action_controller_base.rb +21 -0
- data/lib/instana/activators/action_view.rb +21 -0
- data/lib/instana/activators/active_record.rb +21 -0
- data/lib/instana/activators/cuba.rb +21 -0
- data/lib/instana/activators/dalli.rb +23 -0
- data/lib/instana/activators/excon.rb +20 -0
- data/lib/instana/activators/graphql.rb +22 -0
- data/lib/instana/activators/grpc_client.rb +20 -0
- data/lib/instana/activators/grpc_server.rb +20 -0
- data/lib/instana/activators/net_http.rb +20 -0
- data/lib/instana/activators/rack.rb +16 -0
- data/lib/instana/activators/rails.rb +18 -0
- data/lib/instana/activators/redis.rb +20 -0
- data/lib/instana/activators/resque_client.rb +21 -0
- data/lib/instana/activators/resque_worker.rb +33 -0
- data/lib/instana/activators/rest_client.rb +20 -0
- data/lib/instana/activators/roda.rb +21 -0
- data/lib/instana/activators/sidekiq_client.rb +24 -0
- data/lib/instana/activators/sidekiq_worker.rb +24 -0
- data/lib/instana/activators/sinatra.rb +21 -0
- data/lib/instana/agent.rb +3 -0
- data/lib/instana/agent/helpers.rb +3 -0
- data/lib/instana/agent/hooks.rb +3 -0
- data/lib/instana/agent/tasks.rb +3 -0
- data/lib/instana/base.rb +3 -0
- data/lib/instana/collector.rb +3 -0
- data/lib/instana/collectors/gc.rb +3 -0
- data/lib/instana/collectors/memory.rb +3 -0
- data/lib/instana/collectors/thread.rb +3 -0
- data/lib/instana/config.rb +3 -0
- data/lib/instana/frameworks/cuba.rb +9 -13
- data/lib/instana/frameworks/rails.rb +22 -32
- data/lib/instana/frameworks/roda.rb +10 -13
- data/lib/instana/frameworks/sinatra.rb +4 -8
- data/lib/instana/helpers.rb +3 -0
- data/lib/instana/instrumentation/action_cable.rb +53 -0
- data/lib/instana/instrumentation/action_controller.rb +84 -0
- data/lib/instana/instrumentation/action_view.rb +30 -0
- data/lib/instana/instrumentation/active_record.rb +50 -0
- data/lib/instana/instrumentation/dalli.rb +10 -18
- data/lib/instana/instrumentation/excon.rb +54 -57
- data/lib/instana/instrumentation/graphql.rb +19 -18
- data/lib/instana/instrumentation/grpc.rb +73 -66
- data/lib/instana/instrumentation/instrumented_request.rb +6 -1
- data/lib/instana/instrumentation/net-http.rb +46 -47
- data/lib/instana/instrumentation/rack.rb +4 -0
- data/lib/instana/instrumentation/redis.rb +13 -18
- data/lib/instana/instrumentation/resque.rb +17 -50
- data/lib/instana/instrumentation/rest-client.rb +5 -17
- data/lib/instana/instrumentation/sidekiq-client.rb +3 -9
- data/lib/instana/instrumentation/sidekiq-worker.rb +3 -9
- data/lib/instana/opentracing/carrier.rb +3 -0
- data/lib/instana/opentracing/tracer.rb +3 -0
- data/lib/instana/rack.rb +4 -0
- data/lib/instana/secrets.rb +10 -7
- data/lib/instana/setup.rb +6 -1
- data/lib/instana/thread_local.rb +3 -0
- data/lib/instana/tracer.rb +3 -0
- data/lib/instana/tracing/processor.rb +3 -0
- data/lib/instana/tracing/span.rb +3 -0
- data/lib/instana/tracing/span_context.rb +3 -0
- data/lib/instana/util.rb +4 -41
- data/lib/instana/version.rb +4 -1
- data/lib/oj_check.rb +3 -0
- data/lib/opentracing.rb +3 -0
- data/test/activator_test.rb +30 -0
- data/test/agent/agent_test.rb +3 -0
- data/test/benchmarks/bench_id_generation.rb +3 -0
- data/test/benchmarks/bench_opentracing.rb +3 -0
- data/test/config_test.rb +3 -0
- data/test/frameworks/cuba_test.rb +41 -40
- data/test/frameworks/roda_test.rb +43 -41
- data/test/frameworks/sinatra_test.rb +64 -64
- data/test/instana_test.rb +3 -0
- data/test/instrumentation/dalli_test.rb +3 -0
- data/test/instrumentation/excon_test.rb +4 -0
- data/test/instrumentation/graphql_test.rb +3 -0
- data/test/instrumentation/grpc_test.rb +5 -1
- data/test/instrumentation/{net-http_test.rb → net_http_test.rb} +4 -0
- data/test/instrumentation/{instrumented_request_test.rb → rack_instrumented_request_test.rb} +4 -1
- data/test/{frameworks → instrumentation}/rack_test.rb +3 -1
- data/test/instrumentation/rails_action_cable_test.rb +131 -0
- data/test/{frameworks/rails/actioncontroller_test.rb → instrumentation/rails_action_controller_test.rb} +40 -21
- data/test/instrumentation/rails_action_view_test.rb +151 -0
- data/test/instrumentation/rails_active_record_test.rb +122 -0
- data/test/instrumentation/redis_test.rb +3 -0
- data/test/instrumentation/resque_test.rb +6 -11
- data/test/instrumentation/{rest-client_test.rb → rest_client_test.rb} +9 -0
- data/test/instrumentation/sidekiq-client_test.rb +4 -0
- data/test/instrumentation/sidekiq-worker_test.rb +4 -0
- data/test/secrets_test.rb +3 -0
- data/test/support/apps/active_record/active_record.rb +24 -0
- data/test/{servers/grpc_50051.rb → support/apps/grpc/boot.rb} +4 -1
- data/test/{apps → support/apps/grpc}/grpc_server.rb +3 -0
- data/test/{servers/rackapp_6511.rb → support/apps/http_endpoint/boot.rb} +3 -0
- data/test/{servers/rails_3205.rb → support/apps/rails/boot.rb} +10 -13
- data/test/{models → support/apps/rails/models}/block.rb +4 -1
- data/test/{models → support/apps/rails/models}/block6.rb +3 -0
- data/test/support/apps/resque/boot.rb +5 -0
- data/test/{jobs → support/apps/resque/jobs}/resque_error_job.rb +3 -0
- data/test/{jobs → support/apps/resque/jobs}/resque_fast_job.rb +3 -0
- data/test/support/apps/sidekiq/boot.rb +25 -0
- data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_1.rb +3 -0
- data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_2.rb +3 -0
- data/test/{servers → support/apps}/sidekiq/worker.rb +5 -2
- data/test/support/helpers.rb +97 -0
- data/test/test_helper.rb +27 -144
- data/test/tracing/custom_test.rb +3 -0
- data/test/tracing/id_management_test.rb +4 -0
- data/test/tracing/opentracing_test.rb +3 -0
- data/test/tracing/tracer_async_test.rb +3 -0
- data/test/tracing/tracer_test.rb +3 -0
- metadata +105 -96
- data/gemfiles/libraries.gemfile +0 -73
- data/gemfiles/rails32.gemfile +0 -51
- data/gemfiles/rails42.gemfile +0 -50
- data/gemfiles/rails50.gemfile +0 -52
- data/gemfiles/rails52.gemfile +0 -52
- data/gemfiles/rails60.gemfile +0 -72
- data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +0 -58
- data/lib/instana/frameworks/instrumentation/action_controller.rb +0 -194
- data/lib/instana/frameworks/instrumentation/action_view.rb +0 -43
- data/lib/instana/frameworks/instrumentation/active_record.rb +0 -27
- data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +0 -87
- data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +0 -62
- data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +0 -103
- data/lib/instana/instrumentation.rb +0 -25
- data/lib/instana/test.rb +0 -43
- data/test/apps/cuba.rb +0 -19
- data/test/apps/roda.rb +0 -13
- data/test/apps/sinatra.rb +0 -9
- 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/servers/helpers/sidekiq_worker_initializer.rb +0 -27
@@ -1,6 +1,11 @@
|
|
1
1
|
# Note: We really only need "cgi/util" here but Ruby 2.4.1 has an issue:
|
2
2
|
# https://bugs.ruby-lang.org/issues/13539
|
3
|
-
|
3
|
+
|
4
|
+
# (c) Copyright IBM Corp. 2021
|
5
|
+
# (c) Copyright Instana Inc. 2021
|
6
|
+
|
7
|
+
require 'cgi'
|
8
|
+
require 'rack/request'
|
4
9
|
|
5
10
|
module Instana
|
6
11
|
class InstrumentedRequest < Rack::Request
|
@@ -1,61 +1,60 @@
|
|
1
|
-
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2016
|
2
3
|
|
3
|
-
|
4
|
-
Net::HTTP.class_eval {
|
4
|
+
require 'net/http'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
module Instana
|
7
|
+
module Instrumentation
|
8
|
+
module NetHTTPInstrumentation
|
9
|
+
def request(*args, &block)
|
10
|
+
if !Instana.tracer.tracing? || !started?
|
11
|
+
do_skip = true
|
12
|
+
return super(*args, &block)
|
13
|
+
end
|
11
14
|
|
12
|
-
|
15
|
+
::Instana.tracer.log_entry(:'net-http')
|
13
16
|
|
14
|
-
|
15
|
-
|
17
|
+
# Send out the tracing context with the request
|
18
|
+
request = args[0]
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
# Set request headers; encode IDs as hexadecimal strings
|
21
|
+
t_context = ::Instana.tracer.context
|
22
|
+
request['X-Instana-T'] = t_context.trace_id_header
|
23
|
+
request['X-Instana-S'] = t_context.span_id_header
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
# Collect up KV info now in case any exception is raised
|
26
|
+
kv_payload = { :http => {} }
|
27
|
+
kv_payload[:http][:method] = request.method
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
else
|
29
|
-
if use_ssl?
|
30
|
-
kv_payload[:http][:url] = "https://#{@address}:#{@port}#{request.path}"
|
29
|
+
if request.uri
|
30
|
+
kv_payload[:http][:url] = request.uri.to_s
|
31
31
|
else
|
32
|
-
|
32
|
+
if use_ssl?
|
33
|
+
kv_payload[:http][:url] = "https://#{@address}:#{@port}#{request.path}"
|
34
|
+
else
|
35
|
+
kv_payload[:http][:url] = "http://#{@address}:#{@port}#{request.path}"
|
36
|
+
end
|
33
37
|
end
|
34
|
-
end
|
35
|
-
|
36
|
-
kv_payload[:http][:url] = ::Instana.secrets.remove_from_query(kv_payload[:http][:url])
|
37
38
|
|
38
|
-
|
39
|
-
response = request_without_instana(*args, &block)
|
39
|
+
kv_payload[:http][:url] = ::Instana.secrets.remove_from_query(kv_payload[:http][:url])
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
# Because of the 5xx response, we flag this span as errored but
|
44
|
-
# without a backtrace (no exception)
|
45
|
-
::Instana.tracer.log_error(nil)
|
46
|
-
end
|
41
|
+
# The core call
|
42
|
+
response = super(*args, &block)
|
47
43
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
::Instana.logger.debug "Instrumenting Net::HTTP"
|
44
|
+
kv_payload[:http][:status] = response.code
|
45
|
+
if response.code.to_i.between?(500, 511)
|
46
|
+
# Because of the 5xx response, we flag this span as errored but
|
47
|
+
# without a backtrace (no exception)
|
48
|
+
::Instana.tracer.log_error(nil)
|
49
|
+
end
|
57
50
|
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
response
|
52
|
+
rescue => e
|
53
|
+
::Instana.tracer.log_error(e)
|
54
|
+
raise
|
55
|
+
ensure
|
56
|
+
::Instana.tracer.log_exit(:'net-http', kv_payload) unless do_skip
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
61
60
|
end
|
@@ -1,11 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2017
|
3
|
+
|
4
|
+
module Instana
|
5
|
+
module RedisInstrumentation
|
6
|
+
def call(*args, &block)
|
4
7
|
kv_payload = { redis: {} }
|
5
8
|
dnt_spans = [:redis, :'resque-client', :'sidekiq-client']
|
6
9
|
|
7
|
-
if !Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name)
|
8
|
-
return
|
10
|
+
if !Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name) || !Instana.config[:redis][:enabled]
|
11
|
+
return super(*args, &block)
|
9
12
|
end
|
10
13
|
|
11
14
|
begin
|
@@ -19,7 +22,7 @@ if defined?(::Redis) && ::Instana.config[:redis][:enabled]
|
|
19
22
|
nil
|
20
23
|
end
|
21
24
|
|
22
|
-
|
25
|
+
super(*args, &block)
|
23
26
|
rescue => e
|
24
27
|
::Instana.tracer.log_info({ redis: {error: true} })
|
25
28
|
::Instana.tracer.log_error(e)
|
@@ -29,17 +32,12 @@ if defined?(::Redis) && ::Instana.config[:redis][:enabled]
|
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
alias call_without_instana call
|
35
|
-
alias call call_with_instana
|
36
|
-
|
37
|
-
def call_pipeline_with_instana(*args, &block)
|
35
|
+
def call_pipeline(*args, &block)
|
38
36
|
kv_payload = { redis: {} }
|
39
37
|
dnt_spans = [:redis, :'resque-client', :'sidekiq-client']
|
40
38
|
|
41
|
-
if !Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name)
|
42
|
-
return
|
39
|
+
if !Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name) || !Instana.config[:redis][:enabled]
|
40
|
+
return super(*args, &block)
|
43
41
|
end
|
44
42
|
|
45
43
|
begin
|
@@ -54,7 +52,7 @@ if defined?(::Redis) && ::Instana.config[:redis][:enabled]
|
|
54
52
|
nil
|
55
53
|
end
|
56
54
|
|
57
|
-
|
55
|
+
super(*args, &block)
|
58
56
|
rescue => e
|
59
57
|
::Instana.tracer.log_info({ redis: {error: true} })
|
60
58
|
::Instana.tracer.log_error(e)
|
@@ -63,8 +61,5 @@ if defined?(::Redis) && ::Instana.config[:redis][:enabled]
|
|
63
61
|
::Instana.tracer.log_exit(:redis, kv_payload)
|
64
62
|
end
|
65
63
|
end
|
66
|
-
|
67
|
-
alias call_pipeline_without_instana call_pipeline
|
68
|
-
alias call_pipeline call_pipeline_with_instana
|
69
64
|
end
|
70
65
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2018
|
3
|
+
|
1
4
|
require 'socket'
|
2
5
|
|
3
6
|
module Instana
|
4
7
|
module Instrumentation
|
5
8
|
module ResqueClient
|
6
|
-
def self.
|
9
|
+
def self.prepended(klass)
|
7
10
|
klass.send :extend, ::Resque
|
8
|
-
::Instana::Util.method_alias(klass, :enqueue)
|
9
|
-
::Instana::Util.method_alias(klass, :enqueue_to)
|
10
|
-
::Instana::Util.method_alias(klass, :dequeue)
|
11
11
|
end
|
12
12
|
|
13
13
|
def collect_kvs(op, klass, args)
|
@@ -23,50 +23,46 @@ module Instana
|
|
23
23
|
{ :'resque-client' => kvs }
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
26
|
+
def enqueue(klass, *args)
|
27
27
|
if Instana.tracer.tracing?
|
28
28
|
kvs = collect_kvs(:enqueue, klass, args)
|
29
29
|
|
30
30
|
Instana.tracer.trace(:'resque-client', kvs) do
|
31
|
-
|
31
|
+
super(klass, *args)
|
32
32
|
end
|
33
33
|
else
|
34
|
-
|
34
|
+
super(klass, *args)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def enqueue_to(queue, klass, *args)
|
39
39
|
if Instana.tracer.tracing? && !Instana.tracer.tracing_span?(:'resque-client')
|
40
40
|
kvs = collect_kvs(:enqueue_to, klass, args)
|
41
41
|
kvs[:Queue] = queue.to_s if queue
|
42
42
|
|
43
43
|
Instana.tracer.trace(:'resque-client', kvs) do
|
44
|
-
|
44
|
+
super(queue, klass, *args)
|
45
45
|
end
|
46
46
|
else
|
47
|
-
|
47
|
+
super(queue, klass, *args)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def dequeue(klass, *args)
|
52
52
|
if Instana.tracer.tracing?
|
53
53
|
kvs = collect_kvs(:dequeue, klass, args)
|
54
54
|
|
55
55
|
Instana.tracer.trace(:'resque-client', kvs) do
|
56
|
-
|
56
|
+
super(klass, *args)
|
57
57
|
end
|
58
58
|
else
|
59
|
-
|
59
|
+
super(klass, *args)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
module ResqueWorker
|
65
|
-
def
|
66
|
-
::Instana::Util.method_alias(klass, :perform)
|
67
|
-
end
|
68
|
-
|
69
|
-
def perform_with_instana(job)
|
65
|
+
def perform(job)
|
70
66
|
kvs = {}
|
71
67
|
kvs[:'resque-worker'] = {}
|
72
68
|
|
@@ -81,17 +77,13 @@ module Instana
|
|
81
77
|
end
|
82
78
|
|
83
79
|
Instana.tracer.start_or_continue_trace(:'resque-worker', kvs) do
|
84
|
-
|
80
|
+
super(job)
|
85
81
|
end
|
86
82
|
end
|
87
83
|
end
|
88
84
|
|
89
85
|
module ResqueJob
|
90
|
-
def
|
91
|
-
::Instana::Util.method_alias(klass, :fail)
|
92
|
-
end
|
93
|
-
|
94
|
-
def fail_with_instana(exception)
|
86
|
+
def fail(exception)
|
95
87
|
if Instana.tracer.tracing?
|
96
88
|
::Instana.tracer.log_info(:'resque-worker' => { :error => "#{exception.class}: #{exception}"})
|
97
89
|
::Instana.tracer.log_error(exception)
|
@@ -99,33 +91,8 @@ module Instana
|
|
99
91
|
rescue Exception => e
|
100
92
|
::Instana.logger.debug { "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" } if Instana::Config[:verbose]
|
101
93
|
ensure
|
102
|
-
|
94
|
+
super(exception)
|
103
95
|
end
|
104
96
|
end
|
105
97
|
end
|
106
98
|
end
|
107
|
-
|
108
|
-
if defined?(::Resque) && RUBY_VERSION >= '1.9.3'
|
109
|
-
|
110
|
-
if ::Instana.config[:'resque-client'][:enabled]
|
111
|
-
::Instana.logger.debug 'Instrumenting Resque Client'
|
112
|
-
::Instana::Util.send_include(::Resque, ::Instana::Instrumentation::ResqueClient)
|
113
|
-
end
|
114
|
-
|
115
|
-
if ::Instana.config[:'resque-worker'][:enabled]
|
116
|
-
::Instana.logger.debug 'Instrumenting Resque Worker'
|
117
|
-
|
118
|
-
::Instana::Util.send_include(::Resque::Worker, ::Instana::Instrumentation::ResqueWorker)
|
119
|
-
::Instana::Util.send_include(::Resque::Job, ::Instana::Instrumentation::ResqueJob)
|
120
|
-
|
121
|
-
::Resque.before_fork do |job|
|
122
|
-
::Instana.agent.before_resque_fork
|
123
|
-
end
|
124
|
-
::Resque.after_fork do |job|
|
125
|
-
::Instana.agent.after_resque_fork
|
126
|
-
end
|
127
|
-
|
128
|
-
# Set this so we assure that any remaining collected traces are reported at_exit
|
129
|
-
ENV['RUN_AT_EXIT_HOOKS'] = "1"
|
130
|
-
end
|
131
|
-
end
|
@@ -1,34 +1,22 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2016
|
3
|
+
|
1
4
|
module Instana
|
2
5
|
module Instrumentation
|
3
6
|
module RestClientRequest
|
4
|
-
def
|
5
|
-
if klass.method_defined?(:execute)
|
6
|
-
klass.class_eval do
|
7
|
-
alias execute_without_instana execute
|
8
|
-
alias execute execute_with_instana
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def execute_with_instana & block
|
7
|
+
def execute(&block)
|
14
8
|
# Since RestClient uses net/http under the covers, we just
|
15
9
|
# provide span visibility here. HTTP related KVs are reported
|
16
10
|
# in the Net::HTTP instrumentation
|
17
11
|
::Instana.tracer.log_entry(:'rest-client')
|
18
12
|
|
19
|
-
|
13
|
+
super(&block)
|
20
14
|
rescue => e
|
21
15
|
::Instana.tracer.log_error(e)
|
22
16
|
raise
|
23
17
|
ensure
|
24
18
|
::Instana.tracer.log_exit(:'rest-client')
|
25
19
|
end
|
26
|
-
|
27
20
|
end
|
28
21
|
end
|
29
22
|
end
|
30
|
-
|
31
|
-
if defined?(::RestClient::Request) && ::Instana.config[:'rest-client'][:enabled]
|
32
|
-
::Instana.logger.debug "Instrumenting RestClient"
|
33
|
-
::RestClient::Request.send(:include, ::Instana::Instrumentation::RestClientRequest)
|
34
|
-
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2017
|
3
|
+
|
1
4
|
module Instana
|
2
5
|
module Instrumentation
|
3
6
|
class SidekiqClient
|
@@ -34,12 +37,3 @@ module Instana
|
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
37
|
-
|
38
|
-
if defined?(::Sidekiq) && ::Instana.config[:'sidekiq-client'][:enabled]
|
39
|
-
::Sidekiq.configure_client do |cfg|
|
40
|
-
cfg.client_middleware do |chain|
|
41
|
-
::Instana.logger.debug "Instrumenting Sidekiq client"
|
42
|
-
chain.add ::Instana::Instrumentation::SidekiqClient
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2017
|
3
|
+
|
1
4
|
module Instana
|
2
5
|
module Instrumentation
|
3
6
|
class SidekiqWorker
|
@@ -43,12 +46,3 @@ module Instana
|
|
43
46
|
end
|
44
47
|
end
|
45
48
|
end
|
46
|
-
|
47
|
-
if defined?(::Sidekiq) && ::Instana.config[:'sidekiq-worker'][:enabled]
|
48
|
-
::Sidekiq.configure_server do |cfg|
|
49
|
-
cfg.server_middleware do |chain|
|
50
|
-
::Instana.logger.debug "Instrumenting Sidekiq worker"
|
51
|
-
chain.add ::Instana::Instrumentation::SidekiqWorker
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
data/lib/instana/rack.rb
CHANGED
data/lib/instana/secrets.rb
CHANGED
@@ -1,26 +1,29 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
3
|
+
|
1
4
|
require 'uri'
|
2
5
|
require 'cgi'
|
3
6
|
|
4
7
|
module Instana
|
5
|
-
class Secrets
|
8
|
+
class Secrets
|
6
9
|
def remove_from_query(str, secret_values = Instana.agent.secret_values)
|
7
10
|
return str unless secret_values
|
8
|
-
|
11
|
+
|
9
12
|
url = URI(str)
|
10
|
-
params = CGI.parse(url.query)
|
11
|
-
|
13
|
+
params = CGI.parse(url.query || '')
|
14
|
+
|
12
15
|
redacted = params.map do |k, v|
|
13
16
|
needs_redaction = secret_values['list']
|
14
17
|
.any? { |t| matcher(secret_values['matcher']).(t,k) }
|
15
18
|
[k, needs_redaction ? '<redacted>' : v]
|
16
19
|
end
|
17
|
-
|
20
|
+
|
18
21
|
url.query = URI.encode_www_form(redacted)
|
19
22
|
CGI.unescape(url.to_s)
|
20
23
|
end
|
21
|
-
|
24
|
+
|
22
25
|
private
|
23
|
-
|
26
|
+
|
24
27
|
def matcher(name)
|
25
28
|
case name
|
26
29
|
when 'equals-ignore-case'
|