mirror of
https://github.com/apple/container.git
synced 2026-09-21 07:05:57 +00:00
Add support for container statistics (#318)
Closes #138 This rounds up cgroup and network stats (via netlink) and exposes them via an agent rpc and on LinuxContainer. While this is not an entirely accurate view into the full resources being used by the container given the virtualized nature (doesn't account for vcpu, device etc overhead) it should give an accurate overview of the workload resource usage in the guest. This change besides the stated goal also removes the interfaceStatistics rpc and just moves these network stats into the new containerStatistics one. Related to that, it also renames the InterfaceStatistics struct to NetworkStatistics and moves this into ContainerStatistics as a nested struct.
This commit is contained in:
@@ -68,7 +68,9 @@ public protocol VirtualMachineAgent: Sendable {
|
||||
func routeAddDefault(name: String, gateway: String) async throws
|
||||
func configureDNS(config: DNS, location: String) async throws
|
||||
func configureHosts(config: Hosts, location: String) async throws
|
||||
func interfaceStatistics(name: String) async throws -> InterfaceStatistics
|
||||
|
||||
// Container statistics
|
||||
func containerStatistics(containerIDs: [String]) async throws -> [ContainerStatistics]
|
||||
}
|
||||
|
||||
extension VirtualMachineAgent {
|
||||
@@ -84,7 +86,7 @@ extension VirtualMachineAgent {
|
||||
throw ContainerizationError(.unsupported, message: "writeFile")
|
||||
}
|
||||
|
||||
public func interfaceStatistics(name: String) async throws -> InterfaceStatistics {
|
||||
throw ContainerizationError(.unsupported, message: "interfaceStatistics")
|
||||
public func containerStatistics(containerIDs: [String]) async throws -> [ContainerStatistics] {
|
||||
throw ContainerizationError(.unsupported, message: "containerStatistics")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user