mirror of https://github.com/k3s-io/k3s
Fix kubelet perf data to make work again for perfdash.
parent
918e99e298
commit
5cba1d9892
|
@ -52,7 +52,7 @@ func ApiCallToPerfData(apicalls APIResponsiveness) *perftype.PerfData {
|
||||||
|
|
||||||
// currentKubeletPerfMetricsVersion is the current kubelet performance metrics version. We should
|
// currentKubeletPerfMetricsVersion is the current kubelet performance metrics version. We should
|
||||||
// bump up the version each time we make incompatible change to the metrics.
|
// bump up the version each time we make incompatible change to the metrics.
|
||||||
const currentKubeletPerfMetricsVersion = "v1"
|
const currentKubeletPerfMetricsVersion = "v2"
|
||||||
|
|
||||||
// ResourceUsageToPerfData transforms ResourceUsagePerNode to PerfData. Notice that this function
|
// ResourceUsageToPerfData transforms ResourceUsagePerNode to PerfData. Notice that this function
|
||||||
// only cares about memory usage, because cpu usage information will be extracted from NodesCPUSummary.
|
// only cares about memory usage, because cpu usage information will be extracted from NodesCPUSummary.
|
||||||
|
@ -78,7 +78,7 @@ func PrintPerfData(p *perftype.PerfData) {
|
||||||
// Notice that this function only cares about memory usage, because cpu usage information will be extracted from NodesCPUSummary.
|
// Notice that this function only cares about memory usage, because cpu usage information will be extracted from NodesCPUSummary.
|
||||||
func ResourceUsageToPerfDataWithLabels(usagePerNode ResourceUsagePerNode, labels map[string]string) *perftype.PerfData {
|
func ResourceUsageToPerfDataWithLabels(usagePerNode ResourceUsagePerNode, labels map[string]string) *perftype.PerfData {
|
||||||
items := []perftype.DataItem{}
|
items := []perftype.DataItem{}
|
||||||
for _, usages := range usagePerNode {
|
for node, usages := range usagePerNode {
|
||||||
for c, usage := range usages {
|
for c, usage := range usages {
|
||||||
item := perftype.DataItem{
|
item := perftype.DataItem{
|
||||||
Data: map[string]float64{
|
Data: map[string]float64{
|
||||||
|
@ -88,6 +88,7 @@ func ResourceUsageToPerfDataWithLabels(usagePerNode ResourceUsagePerNode, labels
|
||||||
},
|
},
|
||||||
Unit: "MB",
|
Unit: "MB",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
|
"node": node,
|
||||||
"container": c,
|
"container": c,
|
||||||
"datatype": "resource",
|
"datatype": "resource",
|
||||||
"resource": "memory",
|
"resource": "memory",
|
||||||
|
@ -106,7 +107,7 @@ func ResourceUsageToPerfDataWithLabels(usagePerNode ResourceUsagePerNode, labels
|
||||||
// CPUUsageToPerfDataWithLabels transforms NodesCPUSummary to PerfData with additional labels.
|
// CPUUsageToPerfDataWithLabels transforms NodesCPUSummary to PerfData with additional labels.
|
||||||
func CPUUsageToPerfDataWithLabels(usagePerNode NodesCPUSummary, labels map[string]string) *perftype.PerfData {
|
func CPUUsageToPerfDataWithLabels(usagePerNode NodesCPUSummary, labels map[string]string) *perftype.PerfData {
|
||||||
items := []perftype.DataItem{}
|
items := []perftype.DataItem{}
|
||||||
for _, usages := range usagePerNode {
|
for node, usages := range usagePerNode {
|
||||||
for c, usage := range usages {
|
for c, usage := range usages {
|
||||||
data := map[string]float64{}
|
data := map[string]float64{}
|
||||||
for perc, value := range usage {
|
for perc, value := range usage {
|
||||||
|
@ -117,6 +118,7 @@ func CPUUsageToPerfDataWithLabels(usagePerNode NodesCPUSummary, labels map[strin
|
||||||
Data: data,
|
Data: data,
|
||||||
Unit: "mCPU",
|
Unit: "mCPU",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
|
"node": node,
|
||||||
"container": c,
|
"container": c,
|
||||||
"datatype": "resource",
|
"datatype": "resource",
|
||||||
"resource": "cpu",
|
"resource": "cpu",
|
||||||
|
|
Loading…
Reference in New Issue