Class: Instana::Snapshot::DockerContainer
- Inherits:
-
Object
- Object
- Instana::Snapshot::DockerContainer
- Includes:
- Deltable
- Defined in:
- lib/instana/snapshot/docker_container.rb
Overview
Describes a Docker container visible to the current process
Constant Summary collapse
- ID =
'com.instana.plugin.docker'.freeze
Instance Method Summary collapse
- #data ⇒ Object
- #entity_id ⇒ Object
-
#initialize(container, metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) ⇒ DockerContainer
constructor
A new instance of DockerContainer.
- #snapshot ⇒ Object
Methods included from Deltable
Constructor Details
#initialize(container, metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) ⇒ DockerContainer
Returns a new instance of DockerContainer.
12 13 14 15 16 |
# File 'lib/instana/snapshot/docker_container.rb', line 12 def initialize(container, metadata_uri: ENV['ECS_CONTAINER_METADATA_URI']) @container = container @metadata_uri = URI() @client = Backend::RequestClient.new(@metadata_uri.host, @metadata_uri.port, use_ssl: @metadata_uri.scheme == "https") end |
Instance Method Details
#data ⇒ Object
22 23 24 25 26 27 |
# File 'lib/instana/snapshot/docker_container.rb', line 22 def data metrics = lookup('/task/stats').fetch(@container['DockerId'], {}) container_metrics(metrics) .merge() end |
#entity_id ⇒ Object
18 19 20 |
# File 'lib/instana/snapshot/docker_container.rb', line 18 def entity_id "#{@container['Labels']['com.amazonaws.ecs.task-arn']}::#{@container['Name']}" end |
#snapshot ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/instana/snapshot/docker_container.rb', line 29 def snapshot { name: ID, entityId: entity_id, data: data } end |