File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 ContainerSummary ,
1616 HostSummary ,
1717 MetricType ,
18+ get_container_name ,
1819)
1920
2021
@@ -57,7 +58,7 @@ def get_containers_summary(self) -> List[ContainerSummary]:
5758 )
5859 container_summary = ContainerSummary (
5960 id = attrs ["Id" ],
60- name = attrs ["Name" ],
61+ name = get_container_name ( attrs ["Name" ]) ,
6162 image = attrs ["Config" ]["Image" ],
6263 state = ContainerState [attrs ["State" ]["Status" ]].name ,
6364 metrics = [virtual_memory_metric , cpu_metric ],
Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ class PercentMetric:
4040 percent : float
4141
4242
43+ def get_container_name (container_name : str ) -> str :
44+ if container_name .startswith ("/" ):
45+ return container_name [1 :]
46+ return container_name
47+
48+
4349@dataclass_json (letter_case = LetterCase .CAMEL )
4450@dataclass
4551class ContainerSummary :
You can’t perform that action at this time.
0 commit comments