Print only interesting Kubelet metrics in JSON printer
This commit is contained in:
		@@ -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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user