Class: Instana::Snapshot::FargateProcess
- Inherits:
-
Object
- Object
- Instana::Snapshot::FargateProcess
- Defined in:
- lib/instana/snapshot/fargate_process.rb
Overview
Describes the current process in terms of its existence inside of a Fargate container
Constant Summary collapse
- ID =
'com.instana.plugin.process'.freeze
Instance Method Summary collapse
- #data ⇒ Object
- #entity_id ⇒ Object
-
#initialize(metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) ⇒ FargateProcess
constructor
A new instance of FargateProcess.
- #snapshot ⇒ Object
Constructor Details
#initialize(metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) ⇒ FargateProcess
Returns a new instance of FargateProcess.
11 12 13 14 15 |
# File 'lib/instana/snapshot/fargate_process.rb', line 11 def initialize(metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) = URI() @client = Backend::RequestClient.new(.host, .port, use_ssl: .scheme == "https") @start_time = Time.now end |
Instance Method Details
#data ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/instana/snapshot/fargate_process.rb', line 21 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: 'docker', container: container_id, "com.instana.plugin.host.name": task_id } end |
#entity_id ⇒ Object
17 18 19 |
# File 'lib/instana/snapshot/fargate_process.rb', line 17 def entity_id Process.pid.to_s end |
#snapshot ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/instana/snapshot/fargate_process.rb', line 39 def snapshot { name: ID, entityId: entity_id, data: data } end |