instana 1.199.0 → 1.199.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instana/activators/resque_worker.rb +1 -4
- data/lib/instana/backend/host_agent.rb +16 -8
- data/lib/instana/backend/host_agent_activation_observer.rb +2 -2
- data/lib/instana/backend/serverless_agent.rb +3 -0
- data/lib/instana/secrets.rb +18 -8
- data/lib/instana/version.rb +1 -1
- data/test/backend/host_agent_test.rb +10 -0
- data/test/backend/serverless_agent_test.rb +10 -0
- data/test/secrets_test.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a6f37c619966937fe3690b64d4c42a17ed5ca7da7dc096ec3da0798c2ffb45b
|
4
|
+
data.tar.gz: 6d6af4ce8988c100014548a27fd3ff5b5bc237501d6bfad24ab378a46791b8e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8f9a656945fe059701409a0009e39fc3a48f4e8dc2f49de71f0510f70f0a32b8458b77dcd08ae3d6c04c2aa526272d432646cf00d4df2c77bfd8b5f0237bb93
|
7
|
+
data.tar.gz: 4c599ce06071fd354b0155e0b9b926be067d7b2e8fafd5e89a5f38f16664b5ce4e991aa836a861c8849e29263332965c63fc85068688c66c0d694a906438f236
|
@@ -16,11 +16,8 @@ module Instana
|
|
16
16
|
::Resque::Worker.prepend(::Instana::Instrumentation::ResqueWorker)
|
17
17
|
::Resque::Job.prepend(::Instana::Instrumentation::ResqueJob)
|
18
18
|
|
19
|
-
::Resque.before_fork do |_job|
|
20
|
-
::Instana.agent.before_resque_fork
|
21
|
-
end
|
22
19
|
::Resque.after_fork do |_job|
|
23
|
-
::Instana.agent.
|
20
|
+
::Instana.agent.after_fork
|
24
21
|
end
|
25
22
|
|
26
23
|
# Set this so we assure that any remaining collected traces are reported at_exit
|
@@ -19,17 +19,25 @@ module Instana
|
|
19
19
|
return if ENV.key?('INSTANA_TEST')
|
20
20
|
|
21
21
|
@future = Concurrent::Promises.future do
|
22
|
-
|
23
|
-
@discovery.delete_observers
|
24
|
-
@discovery
|
25
|
-
.with_observer(HostAgentActivationObserver.new(client, @discovery))
|
26
|
-
.with_observer(HostAgentReportingObserver.new(client, @discovery))
|
27
|
-
|
28
|
-
@discovery.swap { nil }
|
29
|
-
client
|
22
|
+
announce
|
30
23
|
end
|
31
24
|
end
|
32
25
|
|
26
|
+
alias start spawn_background_thread
|
27
|
+
|
28
|
+
def announce
|
29
|
+
client = until_not_nil { HostAgentLookup.new.call }
|
30
|
+
@discovery.delete_observers
|
31
|
+
@discovery
|
32
|
+
.with_observer(HostAgentActivationObserver.new(client, @discovery))
|
33
|
+
.with_observer(HostAgentReportingObserver.new(client, @discovery))
|
34
|
+
|
35
|
+
@discovery.swap { nil }
|
36
|
+
client
|
37
|
+
end
|
38
|
+
|
39
|
+
alias after_fork announce
|
40
|
+
|
33
41
|
# @return [Boolean] true if the agent able to send spans to the backend
|
34
42
|
def ready?
|
35
43
|
ENV.key?('INSTANA_TEST') || !@discovery.value.nil?
|
@@ -12,7 +12,7 @@ module Instana
|
|
12
12
|
|
13
13
|
# @param [RequestClient] client used to make requests to the backend
|
14
14
|
# @param [Concurrent::Atom] discovery object used to store discovery response in
|
15
|
-
def initialize(client, discovery, wait_time:
|
15
|
+
def initialize(client, discovery, wait_time: 30, logger: ::Instana.logger, max_wait_tries: 60, proc_table: Sys::ProcTable, socket_proc: default_socket_proc) # rubocop:disable Metrics/ParameterLists
|
16
16
|
@client = client
|
17
17
|
@discovery = discovery
|
18
18
|
@wait_time = wait_time
|
@@ -82,7 +82,7 @@ module Instana
|
|
82
82
|
def try_forever_with_backoff
|
83
83
|
yield
|
84
84
|
rescue DiscoveryError, Net::OpenTimeout => e
|
85
|
-
@logger.
|
85
|
+
@logger.debug(e)
|
86
86
|
sleep(@wait_time)
|
87
87
|
retry
|
88
88
|
rescue StandardError => e
|
data/lib/instana/secrets.rb
CHANGED
@@ -13,21 +13,31 @@ module Instana
|
|
13
13
|
def remove_from_query(str, secret_values = Instana.agent.secret_values)
|
14
14
|
return str unless secret_values
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
begin
|
17
|
+
url = URI(str)
|
18
|
+
params = url.scheme ? CGI.parse(url.query || '') : CGI.parse(url.to_s)
|
19
|
+
|
20
|
+
redacted = redact(params, secret_values)
|
21
|
+
|
22
|
+
url.query = URI.encode_www_form(redacted)
|
23
|
+
url.scheme ? CGI.unescape(url.to_s) : CGI.unescape(url.query)
|
24
|
+
rescue URI::InvalidURIError => _e
|
25
|
+
params = CGI.parse(str || '')
|
26
|
+
redacted = redact(params, secret_values)
|
27
|
+
CGI.unescape(URI.encode_www_form(redacted))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
18
32
|
|
19
|
-
|
33
|
+
def redact(params, secret_values)
|
34
|
+
params.map do |k, v|
|
20
35
|
needs_redaction = secret_values['list']
|
21
36
|
.any? { |t| matcher(secret_values['matcher']).(t,k) }
|
22
37
|
[k, needs_redaction ? '<redacted>' : v]
|
23
38
|
end
|
24
|
-
|
25
|
-
url.query = URI.encode_www_form(redacted)
|
26
|
-
url.scheme ? CGI.unescape(url.to_s) : CGI.unescape(url.query)
|
27
39
|
end
|
28
40
|
|
29
|
-
private
|
30
|
-
|
31
41
|
def matcher(name)
|
32
42
|
case name
|
33
43
|
when 'equals-ignore-case'
|
data/lib/instana/version.rb
CHANGED
@@ -44,4 +44,14 @@ class HostAgentTest < Minitest::Test
|
|
44
44
|
subject = Instana::Backend::HostAgent.new(discovery: discovery)
|
45
45
|
assert_equal 1, subject.source[:e]
|
46
46
|
end
|
47
|
+
|
48
|
+
def test_start
|
49
|
+
subject = Instana::Backend::HostAgent.new
|
50
|
+
assert subject.respond_to? :start
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_after_fork
|
54
|
+
subject = Instana::Backend::HostAgent.new
|
55
|
+
assert subject.respond_to? :after_fork
|
56
|
+
end
|
47
57
|
end
|
@@ -70,4 +70,14 @@ class ServerlesAgentTest < Minitest::Test
|
|
70
70
|
|
71
71
|
subject.timer.block.call
|
72
72
|
end
|
73
|
+
|
74
|
+
def test_start
|
75
|
+
subject = Instana::Backend::ServerlessAgent.new([], timer_class: MockTimer, backend_uri: 'http://10.10.10.10:9292/', logger: Logger.new('/dev/null'))
|
76
|
+
assert subject.respond_to? :start
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_after_fork
|
80
|
+
subject = Instana::Backend::ServerlessAgent.new([], timer_class: MockTimer, backend_uri: 'http://10.10.10.10:9292/', logger: Logger.new('/dev/null'))
|
81
|
+
assert subject.respond_to? :after_fork
|
82
|
+
end
|
73
83
|
end
|
data/test/secrets_test.rb
CHANGED
@@ -78,6 +78,16 @@ class SecretsTest < Minitest::Test
|
|
78
78
|
assert_redacted @subject.remove_from_query(url, sample_config), %w(instantiate)
|
79
79
|
end
|
80
80
|
|
81
|
+
def test_without_url
|
82
|
+
sample_config = {
|
83
|
+
"matcher"=>"contains",
|
84
|
+
"list"=>["stan"]
|
85
|
+
}
|
86
|
+
|
87
|
+
url = 'filter[instantiate]=true'
|
88
|
+
assert_redacted @subject.remove_from_query(url, sample_config), %w(filter[instantiate]), raw_str: true
|
89
|
+
end
|
90
|
+
|
81
91
|
private
|
82
92
|
|
83
93
|
def url_for(keys)
|
@@ -86,10 +96,8 @@ class SecretsTest < Minitest::Test
|
|
86
96
|
url.to_s
|
87
97
|
end
|
88
98
|
|
89
|
-
def assert_redacted(str, keys)
|
90
|
-
|
91
|
-
params = CGI.parse(url.query)
|
92
|
-
|
99
|
+
def assert_redacted(str, keys, raw_str: false)
|
100
|
+
params = raw_str ? CGI.parse(str) : CGI.parse(URI(str).query)
|
93
101
|
assert_equal keys, params.select { |_, v| v == %w(<redacted>) }.keys, 'to be redacted'
|
94
102
|
end
|
95
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.199.
|
4
|
+
version: 1.199.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Giacomo Lombardo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|