@@ -32,7 +32,7 @@ import (
32
32
"k8s.io/kubernetes/pkg/kubelet/status"
33
33
)
34
34
35
- // NewCRIStatsProvider returns a StatsProvider that provides the node stats
35
+ // NewCRIStatsProvider returns a Provider that provides the node stats
36
36
// from cAdvisor and the container stats from CRI.
37
37
func NewCRIStatsProvider (
38
38
cadvisor cadvisor.Interface ,
@@ -43,7 +43,7 @@ func NewCRIStatsProvider(
43
43
imageService internalapi.ImageManagerService ,
44
44
logMetricsService LogMetricsService ,
45
45
osInterface kubecontainer.OSInterface ,
46
- ) * StatsProvider {
46
+ ) * Provider {
47
47
return newStatsProvider (cadvisor , podManager , runtimeCache , newCRIStatsProvider (cadvisor , resourceAnalyzer ,
48
48
runtimeService , imageService , logMetricsService , osInterface ))
49
49
}
@@ -57,28 +57,28 @@ func NewCadvisorStatsProvider(
57
57
runtimeCache kubecontainer.RuntimeCache ,
58
58
imageService kubecontainer.ImageService ,
59
59
statusProvider status.PodStatusProvider ,
60
- ) * StatsProvider {
60
+ ) * Provider {
61
61
return newStatsProvider (cadvisor , podManager , runtimeCache , newCadvisorStatsProvider (cadvisor , resourceAnalyzer , imageService , statusProvider ))
62
62
}
63
63
64
- // newStatsProvider returns a new StatsProvider that provides node stats from
64
+ // newStatsProvider returns a new Provider that provides node stats from
65
65
// cAdvisor and the container stats using the containerStatsProvider.
66
66
func newStatsProvider (
67
67
cadvisor cadvisor.Interface ,
68
68
podManager kubepod.Manager ,
69
69
runtimeCache kubecontainer.RuntimeCache ,
70
70
containerStatsProvider containerStatsProvider ,
71
- ) * StatsProvider {
72
- return & StatsProvider {
71
+ ) * Provider {
72
+ return & Provider {
73
73
cadvisor : cadvisor ,
74
74
podManager : podManager ,
75
75
runtimeCache : runtimeCache ,
76
76
containerStatsProvider : containerStatsProvider ,
77
77
}
78
78
}
79
79
80
- // StatsProvider provides the stats of the node and the pod-managed containers.
81
- type StatsProvider struct {
80
+ // Provider provides the stats of the node and the pod-managed containers.
81
+ type Provider struct {
82
82
cadvisor cadvisor.Interface
83
83
podManager kubepod.Manager
84
84
runtimeCache kubecontainer.RuntimeCache
@@ -101,13 +101,13 @@ type rlimitStatsProvider interface {
101
101
}
102
102
103
103
// RlimitStats returns base information about process count
104
- func (p * StatsProvider ) RlimitStats () (* statsapi.RlimitStats , error ) {
104
+ func (p * Provider ) RlimitStats () (* statsapi.RlimitStats , error ) {
105
105
return pidlimit .Stats ()
106
106
}
107
107
108
108
// GetCgroupStats returns the stats of the cgroup with the cgroupName. Note that
109
109
// this function doesn't generate filesystem stats.
110
- func (p * StatsProvider ) GetCgroupStats (cgroupName string , updateStats bool ) (* statsapi.ContainerStats , * statsapi.NetworkStats , error ) {
110
+ func (p * Provider ) GetCgroupStats (cgroupName string , updateStats bool ) (* statsapi.ContainerStats , * statsapi.NetworkStats , error ) {
111
111
info , err := getCgroupInfo (p .cadvisor , cgroupName , updateStats )
112
112
if err != nil {
113
113
return nil , nil , fmt .Errorf ("failed to get cgroup stats for %q: %v" , cgroupName , err )
@@ -120,7 +120,7 @@ func (p *StatsProvider) GetCgroupStats(cgroupName string, updateStats bool) (*st
120
120
121
121
// GetCgroupCPUAndMemoryStats returns the CPU and memory stats of the cgroup with the cgroupName. Note that
122
122
// this function doesn't generate filesystem stats.
123
- func (p * StatsProvider ) GetCgroupCPUAndMemoryStats (cgroupName string , updateStats bool ) (* statsapi.ContainerStats , error ) {
123
+ func (p * Provider ) GetCgroupCPUAndMemoryStats (cgroupName string , updateStats bool ) (* statsapi.ContainerStats , error ) {
124
124
info , err := getCgroupInfo (p .cadvisor , cgroupName , updateStats )
125
125
if err != nil {
126
126
return nil , fmt .Errorf ("failed to get cgroup stats for %q: %v" , cgroupName , err )
@@ -131,7 +131,7 @@ func (p *StatsProvider) GetCgroupCPUAndMemoryStats(cgroupName string, updateStat
131
131
}
132
132
133
133
// RootFsStats returns the stats of the node root filesystem.
134
- func (p * StatsProvider ) RootFsStats () (* statsapi.FsStats , error ) {
134
+ func (p * Provider ) RootFsStats () (* statsapi.FsStats , error ) {
135
135
rootFsInfo , err := p .cadvisor .RootFsInfo ()
136
136
if err != nil {
137
137
return nil , fmt .Errorf ("failed to get rootFs info: %v" , err )
@@ -162,7 +162,7 @@ func (p *StatsProvider) RootFsStats() (*statsapi.FsStats, error) {
162
162
}
163
163
164
164
// GetContainerInfo returns stats (from cAdvisor) for a container.
165
- func (p * StatsProvider ) GetContainerInfo (podFullName string , podUID types.UID , containerName string , req * cadvisorapiv1.ContainerInfoRequest ) (* cadvisorapiv1.ContainerInfo , error ) {
165
+ func (p * Provider ) GetContainerInfo (podFullName string , podUID types.UID , containerName string , req * cadvisorapiv1.ContainerInfoRequest ) (* cadvisorapiv1.ContainerInfo , error ) {
166
166
// Resolve and type convert back again.
167
167
// We need the static pod UID but the kubecontainer API works with types.UID.
168
168
podUID = types .UID (p .podManager .TranslatePodUID (podUID ))
@@ -186,7 +186,7 @@ func (p *StatsProvider) GetContainerInfo(podFullName string, podUID types.UID, c
186
186
187
187
// GetRawContainerInfo returns the stats (from cadvisor) for a non-Kubernetes
188
188
// container.
189
- func (p * StatsProvider ) GetRawContainerInfo (containerName string , req * cadvisorapiv1.ContainerInfoRequest , subcontainers bool ) (map [string ]* cadvisorapiv1.ContainerInfo , error ) {
189
+ func (p * Provider ) GetRawContainerInfo (containerName string , req * cadvisorapiv1.ContainerInfoRequest , subcontainers bool ) (map [string ]* cadvisorapiv1.ContainerInfo , error ) {
190
190
if subcontainers {
191
191
return p .cadvisor .SubcontainerInfo (containerName , req )
192
192
}
@@ -200,7 +200,7 @@ func (p *StatsProvider) GetRawContainerInfo(containerName string, req *cadvisora
200
200
}
201
201
202
202
// HasDedicatedImageFs returns true if a dedicated image filesystem exists for storing images.
203
- func (p * StatsProvider ) HasDedicatedImageFs () (bool , error ) {
203
+ func (p * Provider ) HasDedicatedImageFs () (bool , error ) {
204
204
device , err := p .containerStatsProvider .ImageFsDevice ()
205
205
if err != nil {
206
206
return false , err
0 commit comments