mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #19688 from gmarek/master
Print only interesting Kubelet metrics in JSON printer
This commit is contained in:
commit
1d8576a486
@ -49,6 +49,22 @@ const (
|
||||
|
||||
type MetricsForE2E metrics.MetricsCollection
|
||||
|
||||
func (m *MetricsForE2E) filterMetrics() {
|
||||
interestingApiServerMetrics := make(metrics.ApiServerMetrics)
|
||||
for _, metric := range InterestingApiServerMetrics {
|
||||
interestingApiServerMetrics[metric] = (*m).ApiServerMetrics[metric]
|
||||
}
|
||||
interestingKubeletMetrics := make(map[string]metrics.KubeletMetrics)
|
||||
for kubelet, grabbed := range (*m).KubeletMetrics {
|
||||
interestingKubeletMetrics[kubelet] = make(metrics.KubeletMetrics)
|
||||
for _, metric := range InterestingKubeletMetrics {
|
||||
interestingKubeletMetrics[kubelet][metric] = grabbed[metric]
|
||||
}
|
||||
}
|
||||
(*m).ApiServerMetrics = interestingApiServerMetrics
|
||||
(*m).KubeletMetrics = interestingKubeletMetrics
|
||||
}
|
||||
|
||||
func (m *MetricsForE2E) PrintHumanReadable() string {
|
||||
buf := bytes.Buffer{}
|
||||
for _, interestingMetric := range InterestingApiServerMetrics {
|
||||
@ -70,6 +86,7 @@ func (m *MetricsForE2E) PrintHumanReadable() string {
|
||||
}
|
||||
|
||||
func (m *MetricsForE2E) PrintJSON() string {
|
||||
m.filterMetrics()
|
||||
return prettyPrintJSON(*m)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user