instana 1.198.0 → 1.199.4
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/lib/instana/activators/resque_worker.rb +1 -4
- data/lib/instana/backend/agent.rb +6 -0
- data/lib/instana/backend/host_agent.rb +16 -8
- data/lib/instana/backend/host_agent_activation_observer.rb +1 -1
- data/lib/instana/backend/serverless_agent.rb +3 -0
- data/lib/instana/secrets.rb +18 -8
- data/lib/instana/setup.rb +2 -0
- data/lib/instana/snapshot/google_cloud_run_instance.rb +69 -0
- data/lib/instana/snapshot/google_cloud_run_process.rb +58 -0
- data/lib/instana/version.rb +1 -1
- data/test/backend/agent_test.rb +13 -0
- 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
- data/test/snapshot/google_cloud_run_instance_test.rb +74 -0
- data/test/snapshot/google_cloud_run_process_test.rb +33 -0
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 312c663203c4deb4371785441a0d2fa2283b9809795bbfb2f5e00a6d9d29cea8
|
|
4
|
+
data.tar.gz: 23393b6158d94cdfd25c1f25c5af4ec6575fdda93b2e5f7292b02dd3e929841c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b010383d56419547cc186a43532d90a1f26c01e3a0cde126257fc9e2633e033cccb7ec8b34583808a2f806cb58b579d4384dbdc43f49e7064f32099be1d5eff4
|
|
7
|
+
data.tar.gz: 30359b5a5e3e25d86517773a9e9aa53c7688470f34472c40ce3078d28f6cc025b56d5417916eba377587b9abd45943f5459f9029e7bf1f2db3ad2612a1e372c9
|
|
@@ -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
|
|
@@ -17,6 +17,12 @@ module Instana
|
|
|
17
17
|
def setup
|
|
18
18
|
@delegate = if ENV.key?('_HANDLER')
|
|
19
19
|
ServerlessAgent.new([Snapshot::LambdaFunction.new])
|
|
20
|
+
elsif ENV.key?('K_REVISION') && ENV.key?('INSTANA_ENDPOINT_URL')
|
|
21
|
+
ServerlessAgent.new([
|
|
22
|
+
Snapshot::GoogleCloudRunProcess.new,
|
|
23
|
+
Snapshot::GoogleCloudRunInstance.new,
|
|
24
|
+
Snapshot::RubyProcess.new
|
|
25
|
+
])
|
|
20
26
|
elsif @fargate_metadata_uri && ENV.key?('INSTANA_ENDPOINT_URL')
|
|
21
27
|
ServerlessAgent.new(fargate_snapshots)
|
|
22
28
|
else
|
|
@@ -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?
|
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/setup.rb
CHANGED
|
@@ -24,6 +24,8 @@ require 'instana/snapshot/fargate_task'
|
|
|
24
24
|
require 'instana/snapshot/fargate_container'
|
|
25
25
|
require 'instana/snapshot/docker_container'
|
|
26
26
|
require 'instana/snapshot/lambda_function'
|
|
27
|
+
require 'instana/snapshot/google_cloud_run_instance'
|
|
28
|
+
require 'instana/snapshot/google_cloud_run_process'
|
|
27
29
|
|
|
28
30
|
require 'instana/backend/host_agent_lookup'
|
|
29
31
|
require 'instana/backend/host_agent_activation_observer'
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
module Instana
|
|
5
|
+
module Snapshot
|
|
6
|
+
# @since 1.199
|
|
7
|
+
class GoogleCloudRunInstance
|
|
8
|
+
ID = 'com.instana.plugin.gcp.run.revision.instance'.freeze
|
|
9
|
+
|
|
10
|
+
def initialize(metadata_uri: 'http://metadata.google.internal')
|
|
11
|
+
@metadata_uri = URI(metadata_uri)
|
|
12
|
+
@client = Backend::RequestClient.new(@metadata_uri.host, @metadata_uri.port, use_ssl: @metadata_uri.scheme == "https")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def entity_id
|
|
16
|
+
lookup('/computeMetadata/v1/instance/id')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def data
|
|
20
|
+
{
|
|
21
|
+
runtime: 'ruby',
|
|
22
|
+
region: gcp_region,
|
|
23
|
+
service: ENV['K_SERVICE'],
|
|
24
|
+
configuration: ENV['K_CONFIGURATION'],
|
|
25
|
+
revision: ENV['K_REVISION'],
|
|
26
|
+
instanceId: entity_id,
|
|
27
|
+
port: ENV['PORT'],
|
|
28
|
+
numericProjectId: lookup('/computeMetadata/v1/project/numeric-project-id'),
|
|
29
|
+
projectId: lookup('/computeMetadata/v1/project/project-id')
|
|
30
|
+
}.compact
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def snapshot
|
|
34
|
+
{
|
|
35
|
+
name: ID,
|
|
36
|
+
entityId: entity_id,
|
|
37
|
+
data: data
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def source
|
|
42
|
+
{
|
|
43
|
+
hl: true,
|
|
44
|
+
cp: 'gcp',
|
|
45
|
+
e: entity_id
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def host_name
|
|
50
|
+
"gcp:cloud-run:revision:#{ENV['K_REVISION']}"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def gcp_region
|
|
56
|
+
lookup('/computeMetadata/v1/instance/zone').split('/').last
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def lookup(resource)
|
|
60
|
+
path = @metadata_uri.path + resource
|
|
61
|
+
response = @client.send_request('GET', path, nil, {'Metadata-Flavor' => 'Google'})
|
|
62
|
+
|
|
63
|
+
raise "Unable to get `#{path}`. Got `#{response.code}` `#{response['location']}`." unless response.ok?
|
|
64
|
+
|
|
65
|
+
response.body
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
module Instana
|
|
5
|
+
module Snapshot
|
|
6
|
+
# @since 1.199.0
|
|
7
|
+
class GoogleCloudRunProcess
|
|
8
|
+
ID = 'com.instana.plugin.process'.freeze
|
|
9
|
+
|
|
10
|
+
def initialize(metadata_uri: 'http://metadata.google.internal')
|
|
11
|
+
@metadata_uri = URI(metadata_uri)
|
|
12
|
+
@client = Backend::RequestClient.new(@metadata_uri.host, @metadata_uri.port, use_ssl: @metadata_uri.scheme == "https")
|
|
13
|
+
@start_time = Time.now
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def entity_id
|
|
17
|
+
Process.pid.to_s
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def data
|
|
21
|
+
proc_table = Sys::ProcTable.ps(pid: Process.pid)
|
|
22
|
+
process = Backend::ProcessInfo.new(proc_table)
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
pid: process.pid.to_i,
|
|
26
|
+
env: ENV.to_h,
|
|
27
|
+
exec: process.name,
|
|
28
|
+
args: process.arguments,
|
|
29
|
+
user: process.uid,
|
|
30
|
+
group: process.gid,
|
|
31
|
+
start: @start_time.to_i * 1000,
|
|
32
|
+
containerType: 'gcpCloudRunInstance',
|
|
33
|
+
container: lookup('/computeMetadata/v1/instance/id'),
|
|
34
|
+
"com.instana.plugin.host.name": "gcp:cloud-run:revision:#{ENV['K_REVISION']}"
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def snapshot
|
|
39
|
+
{
|
|
40
|
+
name: ID,
|
|
41
|
+
entityId: entity_id,
|
|
42
|
+
data: data
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def lookup(resource)
|
|
49
|
+
path = @metadata_uri.path + resource
|
|
50
|
+
response = @client.send_request('GET', path, nil, {'Metadata-Flavor' => 'Google'})
|
|
51
|
+
|
|
52
|
+
raise "Unable to get `#{path}`. Got `#{response.code}` `#{response['location']}`." unless response.ok?
|
|
53
|
+
|
|
54
|
+
response.body
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
data/lib/instana/version.rb
CHANGED
data/test/backend/agent_test.rb
CHANGED
|
@@ -56,6 +56,19 @@ class AgentTest < Minitest::Test
|
|
|
56
56
|
ENV['INSTANA_ENDPOINT_URL'] = nil
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
def test_google_cloud
|
|
60
|
+
ENV['K_REVISION'] = 'TEST'
|
|
61
|
+
ENV['INSTANA_ENDPOINT_URL'] = 'http://example.com'
|
|
62
|
+
|
|
63
|
+
subject = Instana::Backend::Agent.new
|
|
64
|
+
assert_nil subject.delegate
|
|
65
|
+
subject.setup
|
|
66
|
+
assert subject.delegate.is_a?(Instana::Backend::ServerlessAgent)
|
|
67
|
+
ensure
|
|
68
|
+
ENV['K_REVISION'] = nil
|
|
69
|
+
ENV['INSTANA_ENDPOINT_URL'] = nil
|
|
70
|
+
end
|
|
71
|
+
|
|
59
72
|
def test_delegate_super
|
|
60
73
|
subject = Instana::Backend::Agent.new
|
|
61
74
|
assert_raises NoMethodError do
|
|
@@ -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
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
require 'test_helper'
|
|
5
|
+
|
|
6
|
+
class GoogleCloudRunInstanceTest < Minitest::Test
|
|
7
|
+
def test_snapshot
|
|
8
|
+
ENV['K_SERVICE'] = 'test_service'
|
|
9
|
+
ENV['K_CONFIGURATION'] = 'test_config'
|
|
10
|
+
ENV['K_REVISION'] = 'test_revision'
|
|
11
|
+
ENV['PORT'] = 'test_port'
|
|
12
|
+
|
|
13
|
+
stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/instance/id')
|
|
14
|
+
.to_return(status: 200, body: 'test_instance_id')
|
|
15
|
+
stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/instance/zone')
|
|
16
|
+
.to_return(status: 200, body: 'region/number/test_region')
|
|
17
|
+
stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/project/numeric-project-id')
|
|
18
|
+
.to_return(status: 200, body: 'numericProjectId')
|
|
19
|
+
stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/project/project-id')
|
|
20
|
+
.to_return(status: 200, body: 'projectId')
|
|
21
|
+
|
|
22
|
+
subject = Instana::Snapshot::GoogleCloudRunInstance.new(metadata_uri: 'http://10.10.10.10/')
|
|
23
|
+
snapshot = subject.snapshot
|
|
24
|
+
|
|
25
|
+
assert_equal Instana::Snapshot::GoogleCloudRunInstance::ID, snapshot[:name]
|
|
26
|
+
assert_equal 'test_instance_id', snapshot[:entityId]
|
|
27
|
+
|
|
28
|
+
assert_equal "ruby", snapshot[:data][:runtime]
|
|
29
|
+
assert_equal "test_region", snapshot[:data][:region]
|
|
30
|
+
assert_equal "test_service", snapshot[:data][:service]
|
|
31
|
+
assert_equal "test_config", snapshot[:data][:configuration]
|
|
32
|
+
assert_equal "test_revision", snapshot[:data][:revision]
|
|
33
|
+
assert_equal "test_instance_id", snapshot[:data][:instanceId]
|
|
34
|
+
assert_equal "test_port", snapshot[:data][:port]
|
|
35
|
+
assert_equal "numericProjectId", snapshot[:data][:numericProjectId]
|
|
36
|
+
assert_equal "projectId", snapshot[:data][:projectId]
|
|
37
|
+
ensure
|
|
38
|
+
ENV['K_SERVICE'] = nil
|
|
39
|
+
ENV['K_CONFIGURATION'] = nil
|
|
40
|
+
ENV['K_REVISION'] = nil
|
|
41
|
+
ENV['PORT'] = nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_snapshot_error
|
|
45
|
+
stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/instance/id')
|
|
46
|
+
.to_return(status: 500)
|
|
47
|
+
|
|
48
|
+
subject = Instana::Snapshot::GoogleCloudRunInstance.new(metadata_uri: 'http://10.10.10.10/')
|
|
49
|
+
|
|
50
|
+
assert_raises do
|
|
51
|
+
subject.snapshot
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_source
|
|
56
|
+
stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/instance/id')
|
|
57
|
+
.to_return(status: 200, body: 'test_instance_id')
|
|
58
|
+
subject = Instana::Snapshot::GoogleCloudRunInstance.new(metadata_uri: 'http://10.10.10.10/')
|
|
59
|
+
source = subject.source
|
|
60
|
+
|
|
61
|
+
assert source[:hl]
|
|
62
|
+
assert_equal 'gcp', source[:cp]
|
|
63
|
+
assert_equal 'test_instance_id', source[:e]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_host_name
|
|
67
|
+
ENV['K_REVISION'] = 'test_revision'
|
|
68
|
+
subject = Instana::Snapshot::GoogleCloudRunInstance.new(metadata_uri: 'http://10.10.10.10/')
|
|
69
|
+
|
|
70
|
+
assert_equal 'gcp:cloud-run:revision:test_revision', subject.host_name
|
|
71
|
+
ensure
|
|
72
|
+
ENV['K_REVISION'] = nil
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
require 'test_helper'
|
|
5
|
+
|
|
6
|
+
class GoogleCloudRunProcessTest < Minitest::Test
|
|
7
|
+
def test_snapshot
|
|
8
|
+
ENV['K_REVISION'] = 'test'
|
|
9
|
+
stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/instance/id')
|
|
10
|
+
.to_return(status: 200, body: 'test_instance_id')
|
|
11
|
+
|
|
12
|
+
subject = Instana::Snapshot::GoogleCloudRunProcess.new(metadata_uri: 'http://10.10.10.10/')
|
|
13
|
+
snapshot = subject.snapshot
|
|
14
|
+
|
|
15
|
+
assert_equal Instana::Snapshot::GoogleCloudRunProcess::ID, snapshot[:name]
|
|
16
|
+
assert_equal 'test_instance_id', snapshot[:data][:container]
|
|
17
|
+
assert_equal 'gcpCloudRunInstance', snapshot[:data][:containerType]
|
|
18
|
+
assert_equal 'gcp:cloud-run:revision:test', snapshot[:data][:'com.instana.plugin.host.name']
|
|
19
|
+
ensure
|
|
20
|
+
ENV['K_REVISION'] = nil
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_snapshot_error
|
|
24
|
+
stub_request(:get, 'http://10.10.10.10//computeMetadata/v1/instance/id')
|
|
25
|
+
.to_return(status: 500)
|
|
26
|
+
|
|
27
|
+
subject = Instana::Snapshot::GoogleCloudRunProcess.new(metadata_uri: 'http://10.10.10.10/')
|
|
28
|
+
|
|
29
|
+
assert_raises do
|
|
30
|
+
subject.snapshot
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
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.
|
|
4
|
+
version: 1.199.4
|
|
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-04-
|
|
11
|
+
date: 2021-04-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -262,6 +262,8 @@ files:
|
|
|
262
262
|
- lib/instana/snapshot/fargate_container.rb
|
|
263
263
|
- lib/instana/snapshot/fargate_process.rb
|
|
264
264
|
- lib/instana/snapshot/fargate_task.rb
|
|
265
|
+
- lib/instana/snapshot/google_cloud_run_instance.rb
|
|
266
|
+
- lib/instana/snapshot/google_cloud_run_process.rb
|
|
265
267
|
- lib/instana/snapshot/lambda_function.rb
|
|
266
268
|
- lib/instana/snapshot/ruby_process.rb
|
|
267
269
|
- lib/instana/tracer.rb
|
|
@@ -314,6 +316,8 @@ files:
|
|
|
314
316
|
- test/snapshot/fargate_container_test.rb
|
|
315
317
|
- test/snapshot/fargate_process_test.rb
|
|
316
318
|
- test/snapshot/fargate_task_test.rb
|
|
319
|
+
- test/snapshot/google_cloud_run_instance_test.rb
|
|
320
|
+
- test/snapshot/google_cloud_run_process_test.rb
|
|
317
321
|
- test/snapshot/lambda_function_test.rb
|
|
318
322
|
- test/snapshot/ruby_process_test.rb
|
|
319
323
|
- test/support/apps/active_record/active_record.rb
|
|
@@ -386,8 +390,10 @@ test_files:
|
|
|
386
390
|
- test/snapshot/deltable_test.rb
|
|
387
391
|
- test/snapshot/fargate_task_test.rb
|
|
388
392
|
- test/snapshot/ruby_process_test.rb
|
|
393
|
+
- test/snapshot/google_cloud_run_process_test.rb
|
|
389
394
|
- test/snapshot/lambda_function_test.rb
|
|
390
395
|
- test/snapshot/fargate_container_test.rb
|
|
396
|
+
- test/snapshot/google_cloud_run_instance_test.rb
|
|
391
397
|
- test/backend/host_agent_activation_observer_test.rb
|
|
392
398
|
- test/backend/host_agent_reporting_observer_test.rb
|
|
393
399
|
- test/backend/gc_snapshot_test.rb
|