Merge pull request #2559 from katarzyna-z/kk-fix-perf-stats-api

Fixes perf stats and hugetlb stats on API v2.0
This commit is contained in:
David Ashpole 2020-05-27 08:54:59 -07:00 committed by GitHub
commit 147ca3e36c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -120,7 +120,8 @@ type DeprecatedContainerStats struct {
HasMemory bool `json:"has_memory"`
Memory v1.MemoryStats `json:"memory,omitempty"`
// Hugepage statistics
HasHugetlb bool `json:"has_hugetlb"`
HasHugetlb bool `json:"has_hugetlb"`
Hugetlb map[string]v1.HugetlbStats `json:"hugetlb,omitempty"`
// Network statistics
HasNetwork bool `json:"has_network"`
Network NetworkStats `json:"network,omitempty"`
@ -136,6 +137,8 @@ type DeprecatedContainerStats struct {
// Custom Metrics
HasCustomMetrics bool `json:"has_custom_metrics"`
CustomMetrics map[string][]v1.MetricVal `json:"custom_metrics,omitempty"`
// Perf events counters
PerfStats []v1.PerfStat `json:"perf_stats,omitempty"`
// Referenced memory
ReferencedMemory uint64 `json:"referenced_memory,omitempty"`
}

View File

@ -169,6 +169,7 @@ func DeprecatedStatsFromV1(cont *v1.ContainerInfo) []DeprecatedContainerStats {
Timestamp: val.Timestamp,
HasCpu: cont.Spec.HasCpu,
HasMemory: cont.Spec.HasMemory,
HasHugetlb: cont.Spec.HasHugetlb,
HasNetwork: cont.Spec.HasNetwork,
HasFilesystem: cont.Spec.HasFilesystem,
HasDiskIo: cont.Spec.HasDiskIo,
@ -188,6 +189,9 @@ func DeprecatedStatsFromV1(cont *v1.ContainerInfo) []DeprecatedContainerStats {
if stat.HasMemory {
stat.Memory = val.Memory
}
if stat.HasHugetlb {
stat.Hugetlb = val.Hugetlb
}
if stat.HasNetwork {
stat.Network.Interfaces = val.Network.Interfaces
}
@ -203,6 +207,9 @@ func DeprecatedStatsFromV1(cont *v1.ContainerInfo) []DeprecatedContainerStats {
if stat.HasCustomMetrics {
stat.CustomMetrics = val.CustomMetrics
}
if len(val.PerfStats) > 0 {
stat.PerfStats = val.PerfStats
}
// TODO(rjnagal): Handle load stats.
stats = append(stats, stat)
}