scheduler-perf: fix perfdash display problem
perfdash expects all data items to have the same set of labels. It then
renders drop-down buttons for each label with all values found for each
label. Previously, data items that didn't have a label didn't match any label
filter in perfdash and couldn't get selected because perfdash doesn't have
"unset" in it's drop-down menus.
To avoid that, scheduler-perf now collects all labels and then adds missing
labels with "not applicable" as value:
{
"data": {
"Average": 939.7071223010004,
"Perc50": 927.7987421383649,
"Perc90": 2166.153846153846,
"Perc95": 2363.076923076923,
"Perc99": 2520.6153846153848
},
"unit": "ms",
"labels": {
"Metric": "scheduler_pod_scheduling_duration_seconds",
"Name": "SchedulingBasic/5000Nodes/namespace-2",
"extension_point": "not applicable",
"result": "not applicable"
}
},
...
{
"data": {
"Average": 1.1172570650000004,
"Perc50": 1.1418367346938776,
"Perc90": 1.5500000000000003,
"Perc95": 1.6410256410256412,
"Perc99": 3.7333333333333334
},
"unit": "ms",
"labels": {
"Metric": "scheduler_framework_extension_point_duration_seconds",
"Name": "SchedulingBasic/5000Nodes/namespace-2",
"extension_point": "Score",
"result": "not applicable"
}
},
This commit is contained in:
@@ -196,6 +196,27 @@ func makeBasePod() *v1.Pod {
|
||||
}
|
||||
|
||||
func dataItems2JSONFile(dataItems DataItems, namePrefix string) error {
|
||||
// perfdash expects all data items to have the same set of labels. It
|
||||
// then renders drop-down buttons for each label with all values found
|
||||
// for each label. If we were to store data items that don't have a
|
||||
// certain label, then perfdash will never show those data items
|
||||
// because it will only show data items that have the currently
|
||||
// selected label value. To avoid that, we collect all labels used
|
||||
// anywhere and then add missing labels with "not applicable" as value.
|
||||
labels := sets.New[string]()
|
||||
for _, item := range dataItems.DataItems {
|
||||
for label := range item.Labels {
|
||||
labels.Insert(label)
|
||||
}
|
||||
}
|
||||
for _, item := range dataItems.DataItems {
|
||||
for label := range labels {
|
||||
if _, ok := item.Labels[label]; !ok {
|
||||
item.Labels[label] = "not applicable"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b, err := json.Marshal(dataItems)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user