mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
Merge pull request #119048 from pohly/scheduler-perf-metrics-for-perfdash
scheduler-perf: metrics for perfdash
This commit is contained in:
commit
d653dcab5a
@ -996,7 +996,10 @@ func runWorkload(ctx context.Context, tb testing.TB, tc *testCase, w *workload,
|
|||||||
if concreteOp.CollectMetrics {
|
if concreteOp.CollectMetrics {
|
||||||
collectorCtx, collectorCancel = context.WithCancel(ctx)
|
collectorCtx, collectorCancel = context.WithCancel(ctx)
|
||||||
defer collectorCancel()
|
defer collectorCancel()
|
||||||
collectors = getTestDataCollectors(tb, podInformer, fmt.Sprintf("%s/%s", tb.Name(), namespace), namespace, tc.MetricsCollectorConfig, throughputErrorMargin)
|
name := tb.Name()
|
||||||
|
// The first part is the same for each work load, therefore we can strip it.
|
||||||
|
name = name[strings.Index(name, "/")+1:]
|
||||||
|
collectors = getTestDataCollectors(tb, podInformer, fmt.Sprintf("%s/%s", name, namespace), namespace, tc.MetricsCollectorConfig, throughputErrorMargin)
|
||||||
for _, collector := range collectors {
|
for _, collector := range collectors {
|
||||||
// Need loop-local variable for function below.
|
// Need loop-local variable for function below.
|
||||||
collector := collector
|
collector := collector
|
||||||
|
@ -196,6 +196,27 @@ func makeBasePod() *v1.Pod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func dataItems2JSONFile(dataItems DataItems, namePrefix string) error {
|
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)
|
b, err := json.Marshal(dataItems)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user