Class: ElasticAPM::Metadata::SystemInfo::ContainerInfo Private
- Inherits:
-
Object
- Object
- ElasticAPM::Metadata::SystemInfo::ContainerInfo
- Defined in:
- lib/elastic_apm/metadata/system_info/container_info.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- CGROUP_PATH =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'/proc/pid/cgroup'
Instance Attribute Summary collapse
- #cgroup_path ⇒ Object readonly private
- #container_id ⇒ Object private
- #kupernetes_namespace ⇒ Object private
- #kupernetes_node_name ⇒ Object private
- #kupernetes_pod_name ⇒ Object private
- #kupernetes_pod_uid ⇒ Object private
Class Method Summary collapse
- .read! ⇒ Object private
Instance Method Summary collapse
- #container ⇒ Object private
-
#initialize(cgroup_path: CGROUP_PATH) ⇒ ContainerInfo
constructor
private
A new instance of ContainerInfo.
- #kupernetes ⇒ Object private
- #read! ⇒ Object private
Constructor Details
#initialize(cgroup_path: CGROUP_PATH) ⇒ ContainerInfo
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ContainerInfo.
13 14 15 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 13 def initialize(cgroup_path: CGROUP_PATH) @cgroup_path = cgroup_path end |
Instance Attribute Details
#cgroup_path ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 17 def cgroup_path @cgroup_path end |
#container_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 10 def container_id @container_id end |
#kupernetes_namespace ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 10 def kupernetes_namespace @kupernetes_namespace end |
#kupernetes_node_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 10 def kupernetes_node_name @kupernetes_node_name end |
#kupernetes_pod_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 10 def kupernetes_pod_name @kupernetes_pod_name end |
#kupernetes_pod_uid ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 10 def kupernetes_pod_uid @kupernetes_pod_uid end |
Class Method Details
.read! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 25 def self.read! new.read! end |
Instance Method Details
#container ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 32 33 34 35 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 29 def container @container ||= begin return unless container_id { id: container_id } end end |
#kupernetes ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 37 def kupernetes @kupernetes = begin kupernetes = {} kupernetes[:namespace] = kupernetes_namespace kupernetes[:node_name] = kupernetes_node_name kupernetes[:pod_name] = kupernetes_pod_name kupernetes[:pod_uid] = kupernetes_pod_uid return nil if kupernetes.values.all?(&:nil?) kupernetes end end |
#read! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 23 |
# File 'lib/elastic_apm/metadata/system_info/container_info.rb', line 19 def read! read_from_cgroup! read_from_env! self end |