Class: Atatus::Metadata::SystemInfo::ContainerInfo Private
- Inherits:
-
Object
- Object
- Atatus::Metadata::SystemInfo::ContainerInfo
- Defined in:
- lib/atatus/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/self/cgroup'
Instance Attribute Summary collapse
- #cgroup_path ⇒ Object readonly private
- #container_id ⇒ Object private
- #kubernetes_namespace ⇒ Object private
- #kubernetes_node_name ⇒ Object private
- #kubernetes_pod_name ⇒ Object private
- #kubernetes_pod_uid ⇒ Object private
Class Method Summary collapse
- .read!(hostname) ⇒ Object private
Instance Method Summary collapse
- #container ⇒ Object private
-
#initialize(cgroup_path: CGROUP_PATH) ⇒ ContainerInfo
constructor
private
A new instance of ContainerInfo.
- #kubernetes ⇒ Object private
- #read!(hostname) ⇒ 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.
30 31 32 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 30 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.
34 35 36 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 34 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.
27 28 29 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 27 def container_id @container_id end |
#kubernetes_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.
27 28 29 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 27 def kubernetes_namespace @kubernetes_namespace end |
#kubernetes_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.
27 28 29 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 27 def kubernetes_node_name @kubernetes_node_name end |
#kubernetes_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.
27 28 29 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 27 def kubernetes_pod_name @kubernetes_pod_name end |
#kubernetes_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.
27 28 29 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 27 def kubernetes_pod_uid @kubernetes_pod_uid end |
Class Method Details
.read!(hostname) ⇒ 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.
43 44 45 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 43 def self.read!(hostname) new.read!(hostname) 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.
47 48 49 50 51 52 53 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 47 def container @container ||= begin return unless container_id { id: container_id } end end |
#kubernetes ⇒ 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.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 55 def kubernetes @kubernetes = begin kubernetes = { namespace: kubernetes_namespace, node: { name: kubernetes_node_name }, pod: { name: kubernetes_pod_name, uid: kubernetes_pod_uid } } return nil if kubernetes.values.all?(&:nil?) kubernetes end end |
#read!(hostname) ⇒ 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.
36 37 38 39 40 41 |
# File 'lib/atatus/metadata/system_info/container_info.rb', line 36 def read!(hostname) read_from_cgroup! self.kubernetes_pod_name = hostname if kubernetes_pod_uid read_from_env! self end |