Class: Instana::Snapshot::FargateTask

Inherits:
Object
  • Object
show all
Defined in:
lib/instana/snapshot/fargate_task.rb

Overview

Describes the current process in terms of its existence inside of a Fargate task

Since:

  • 1.197.0

Constant Summary collapse

ID =

Since:

  • 1.197.0

'com.instana.plugin.aws.ecs.task'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) ⇒ FargateTask

Returns a new instance of FargateTask.

Since:

  • 1.197.0



11
12
13
14
# File 'lib/instana/snapshot/fargate_task.rb', line 11

def initialize(metadata_uri: ENV['ECS_CONTAINER_METADATA_URI'])
   = URI()
  @client = Backend::RequestClient.new(.host, .port, use_ssl: .scheme == "https")
end

Instance Method Details

#dataObject

Since:

  • 1.197.0



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/instana/snapshot/fargate_task.rb', line 21

def data
  {
    taskArn: ['TaskARN'],
    clusterArn: ['Cluster'],
    taskDefinition: ['Family'],
    taskDefinitionVersion: ['Revision'],
    availabilityZone: ['AvailabilityZone'],
    desiredStatus: ['DesiredStatus'],
    knownStatus: ['KnownStatus'],
    pullStartedAt: ['PullStartedAt'],
    pullStoppedAt: ['PullStoppedAt'],
    instanaZone: instana_zone,
    tags: instana_tags
  }.reject { |_, v| v.nil? }
end

#entity_idObject Also known as: host_name

Since:

  • 1.197.0



16
17
18
# File 'lib/instana/snapshot/fargate_task.rb', line 16

def entity_id
  ['TaskARN']
end

#snapshotObject

Since:

  • 1.197.0



37
38
39
40
41
42
43
# File 'lib/instana/snapshot/fargate_task.rb', line 37

def snapshot
  {
    name: ID,
    entityId: entity_id,
    data: data
  }
end