mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Implement metrics for Windows Nodes
This implements stats for windows nodes in a new package, winstats. WinStats exports methods to get cadvisor like datastructures, however with windows specific metrics. WinStats only gets node level metrics and information, container stats will go via the CRI. This enables the use of the summary api to get metrics for windows nodes.
This commit is contained in:
@@ -22,16 +22,19 @@ import (
|
||||
"github.com/google/cadvisor/events"
|
||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||
"k8s.io/kubernetes/pkg/kubelet/winstats"
|
||||
)
|
||||
|
||||
type cadvisorClient struct {
|
||||
winStatsClient winstats.Client
|
||||
}
|
||||
|
||||
var _ Interface = new(cadvisorClient)
|
||||
|
||||
// New creates a cAdvisor and exports its API on the specified port if port > 0.
|
||||
func New(address string, port uint, imageFsInfoProvider ImageFsInfoProvider, rootPath string) (Interface, error) {
|
||||
return &cadvisorClient{}, nil
|
||||
client, err := winstats.NewPerfCounterClient()
|
||||
return &cadvisorClient{winStatsClient: client}, err
|
||||
}
|
||||
|
||||
func (cu *cadvisorClient) Start() error {
|
||||
@@ -47,7 +50,7 @@ func (cu *cadvisorClient) ContainerInfo(name string, req *cadvisorapi.ContainerI
|
||||
}
|
||||
|
||||
func (cu *cadvisorClient) ContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error) {
|
||||
return make(map[string]cadvisorapiv2.ContainerInfo), nil
|
||||
return cu.winStatsClient.WinContainerInfos()
|
||||
}
|
||||
|
||||
func (cu *cadvisorClient) SubcontainerInfo(name string, req *cadvisorapi.ContainerInfoRequest) (map[string]*cadvisorapi.ContainerInfo, error) {
|
||||
@@ -55,11 +58,11 @@ func (cu *cadvisorClient) SubcontainerInfo(name string, req *cadvisorapi.Contain
|
||||
}
|
||||
|
||||
func (cu *cadvisorClient) MachineInfo() (*cadvisorapi.MachineInfo, error) {
|
||||
return &cadvisorapi.MachineInfo{}, nil
|
||||
return cu.winStatsClient.WinMachineInfo()
|
||||
}
|
||||
|
||||
func (cu *cadvisorClient) VersionInfo() (*cadvisorapi.VersionInfo, error) {
|
||||
return &cadvisorapi.VersionInfo{}, nil
|
||||
return cu.winStatsClient.WinVersionInfo()
|
||||
}
|
||||
|
||||
func (cu *cadvisorClient) ImagesFsInfo() (cadvisorapiv2.FsInfo, error) {
|
||||
|
||||
Reference in New Issue
Block a user