Class: Instana::Snapshot::FargateContainer
- Inherits:
-
Object
- Object
- Instana::Snapshot::FargateContainer
- Defined in:
- lib/instana/snapshot/fargate_container.rb
Overview
Describes a Fargate container visible to the current process
Constant Summary collapse
- ID =
'com.instana.plugin.aws.ecs.container'.freeze
Instance Method Summary collapse
- #data ⇒ Object
- #entity_id ⇒ Object
-
#initialize(container, metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) ⇒ FargateContainer
constructor
A new instance of FargateContainer.
- #snapshot ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(container, metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) ⇒ FargateContainer
Returns a new instance of FargateContainer.
11 12 13 14 15 |
# File 'lib/instana/snapshot/fargate_container.rb', line 11 def initialize(container, metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) @container = container = URI() @client = Backend::RequestClient.new(.host, .port, use_ssl: .scheme == "https") end |
Instance Method Details
#data ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/instana/snapshot/fargate_container.rb', line 21 def data payload = { dockerId: @container['DockerId'], dockerName: @container['DockerName'], containerName: @container['Name'], image: @container['Image'], imageId: @container['ImageID'], taskArn: @container['Labels']['com.amazonaws.ecs.task-arn'], taskDefinition: @container['Labels']['com.amazonaws.ecs.task-definition-data.family'], taskDefinitionVersion: @container['Labels']['com.amazonaws.ecs.task-definition-data.version'], clusterArn: @container['Labels']['com.amazonaws.ecs.cluster'], desiredStatus: @container['DesiredStatus'], knownStatus: @container['KnownStatus'], ports: @container['Ports'], limits: { cpu: @container['Limits']['CPU'], memory: @container['Limits']['Memory'] }, createdAt: @container['CreatedAt'], startedAt: @container['StartedAt'] } if current_container? payload[:instrumented] = true payload[:runtime] = 'ruby' end payload end |
#entity_id ⇒ Object
17 18 19 |
# File 'lib/instana/snapshot/fargate_container.rb', line 17 def entity_id "#{@container['Labels']['com.amazonaws.ecs.task-arn']}::#{@container['Name']}" end |
#snapshot ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/instana/snapshot/fargate_container.rb', line 51 def snapshot { name: ID, entityId: entity_id, data: data } end |
#source ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/instana/snapshot/fargate_container.rb', line 59 def source return unless current_container? { hl: true, cp: 'aws', e: entity_id } end |