Class: Instana::Snapshot::GoogleCloudRunProcess
- Inherits:
-
Object
- Object
- Instana::Snapshot::GoogleCloudRunProcess
- Defined in:
- lib/instana/snapshot/google_cloud_run_process.rb
Overview
Constant Summary collapse
- ID =
'com.instana.plugin.process'.freeze
Instance Method Summary collapse
- #data ⇒ Object
- #entity_id ⇒ Object
-
#initialize(metadata_uri: 'http://metadata.google.internal') ⇒ GoogleCloudRunProcess
constructor
A new instance of GoogleCloudRunProcess.
- #snapshot ⇒ Object
Constructor Details
#initialize(metadata_uri: 'http://metadata.google.internal') ⇒ GoogleCloudRunProcess
Returns a new instance of GoogleCloudRunProcess.
10 11 12 13 14 |
# File 'lib/instana/snapshot/google_cloud_run_process.rb', line 10 def initialize(metadata_uri: 'http://metadata.google.internal') @metadata_uri = URI() @client = Backend::RequestClient.new(@metadata_uri.host, @metadata_uri.port, use_ssl: @metadata_uri.scheme == "https") @start_time = Time.now end |
Instance Method Details
#data ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/instana/snapshot/google_cloud_run_process.rb', line 20 def data proc_table = Sys::ProcTable.ps(pid: Process.pid) process = Backend::ProcessInfo.new(proc_table) { pid: process.pid.to_i, env: ENV.to_h, exec: process.name, args: process.arguments, user: process.uid, group: process.gid, start: @start_time.to_i * 1000, containerType: 'gcpCloudRunInstance', container: lookup('/computeMetadata/v1/instance/id'), "com.instana.plugin.host.name": "gcp:cloud-run:revision:#{ENV['K_REVISION']}" } end |
#entity_id ⇒ Object
16 17 18 |
# File 'lib/instana/snapshot/google_cloud_run_process.rb', line 16 def entity_id Process.pid.to_s end |
#snapshot ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/instana/snapshot/google_cloud_run_process.rb', line 38 def snapshot { name: ID, entityId: entity_id, data: data } end |