Change:
<!-- Please only use this template for submitting enhancement requests --What would you like to be : run got the below error message, We should provide the metric data for different extension points from the metric of "schedulerframeworkextensionpointdurationseconds" Why is this needed: Those metrics have been removed by this commit - Those metrics are deprecated cause it is suggested to use - , but simply remove those metrics definitely is not a nice way to address the issue. /sig scheduling
/triage accept
The label(s) cannot be applied, because the repository doesn't have them <detailsIn response to : /triage accept Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/triage accepted
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-contributor-experience at . /lifecycle stale
/lifecycle stale
/remove-lifecycle stale
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-contributor-experience at . /lifecycle stale
/remove-lifecycle stale

Discussion:
return nil, fmt.Errorf("metric %q not found", metricName) } <del> if metricFamily.GetMetric() == nil { return nil, fmt.Errorf("metric %q is empty", metricName) } </del> if len(metricFamily.GetMetric()) == 0 { return nil, fmt.Errorf("metric %q is empty", metricName) }

"fmt" "math" "reflect" <ins> "sync" </ins> "testing" <del> "k8s.io/utils/pointer" </del> <ins> "github.com/google/go-cmp/cmp" </ins> dto "github.com/prometheus/client_model/go" <ins> "k8s.io/component-base/metrics" "k8s.io/component-base/metrics/legacyregistry" "k8s.io/utils/pointer" </ins> ) func samples2Histogram(samples []float64, upperBounds []float64) Histogram {

}) } } <ins> func TestGetHistogramVecFromGatherer(t *testing.T) { var registerMetrics sync.Once tests := []struct { name    string lvMap   map[string]string wantVec HistogramVec }{ { name:  "filter with one label", lvMap: map[string]string{"label1": "value1-0"}, wantVec: HistogramVec{ &Histogram{&dto.Histogram{ SampleCount: uint64Ptr(1), SampleSum:   pointer.Float64Ptr(1.5), Bucket: []*dto.Bucket{ {CumulativeCount: uint64Ptr(0), UpperBound: pointer.Float64Ptr(0.5)}, {CumulativeCount: uint64Ptr(1), UpperBound: pointer.Float64Ptr(2.0)}, {CumulativeCount: uint64Ptr(1), UpperBound: pointer.Float64Ptr(5.0)}, }, }}, &Histogram{&dto.Histogram{ SampleCount: uint64Ptr(1), SampleSum:   pointer.Float64Ptr(2.5), Bucket: []*dto.Bucket{ {CumulativeCount: uint64Ptr(0), UpperBound: pointer.Float64Ptr(0.5)}, {CumulativeCount: uint64Ptr(0), UpperBound: pointer.Float64Ptr(2.0)}, {CumulativeCount: uint64Ptr(1), UpperBound: pointer.Float64Ptr(5.0)}, }, }}, }, }, { name:  "filter with two labels", lvMap: map[string]string{"label1": "value1-0", "label2": "value2-1"}, wantVec: HistogramVec{ &Histogram{&dto.Histogram{ SampleCount: uint64Ptr(1), SampleSum:   pointer.Float64Ptr(2.5), Bucket: []*dto.Bucket{ {CumulativeCount: uint64Ptr(0), UpperBound: pointer.Float64Ptr(0.5)}, {CumulativeCount: uint64Ptr(0), UpperBound: pointer.Float64Ptr(2.0)}, {CumulativeCount: uint64Ptr(1), UpperBound: pointer.Float64Ptr(5.0)}, }, }}, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { buckets := []float64{.5, 2, 5} // HistogramVec has two labels defined. labels := []string{"label1", "label2"} HistogramOpts := &metrics.HistogramOpts{ Namespace: "namespace", Name:      "metric_test_name", Subsystem: "subsystem", Help:      "histogram help message", Buckets:   buckets, } vec := metrics.NewHistogramVec(HistogramOpts, labels) registerMetrics.Do(func() { legacyregistry.MustRegister(vec) }) // Observe two metrics with same value for label1 but different value of label2. vec.WithLabelValues("value1-0", "value2-0").Observe(1.5) vec.WithLabelValues("value1-0", "value2-1").Observe(2.5) vec.WithLabelValues("value1-1", "value2-0").Observe(3.5) vec.WithLabelValues("value1-1", "value2-1").Observe(4.5) metricName := fmt.Sprintf("%s_%s_%s", HistogramOpts.Namespace, HistogramOpts.Subsystem, HistogramOpts.Name) histogramVec, _ := GetHistogramVecFromGatherer(legacyregistry.DefaultGatherer, metricName, tt.lvMap) if diff := cmp.Diff(tt.wantVec, histogramVec); diff != "" { t.Errorf("Got unexpected HistogramVec (-want +got):n%s", diff) } }) } } </ins>

) const ( <del> configFile             = "config/performance-config.yaml" createNodesOpcode      = "createNodes" createNamespacesOpcode = "createNamespaces" createPodsOpcode       = "createPods" createPodSetsOpcode    = "createPodSets" churnOpcode            = "churn" barrierOpcode          = "barrier" </del> <ins> configFile               = "config/performance-config.yaml" createNodesOpcode        = "createNodes" createNamespacesOpcode   = "createNamespaces" createPodsOpcode         = "createPods" createPodSetsOpcode      = "createPodSets" churnOpcode              = "churn" barrierOpcode            = "barrier" extensionPointsLabelName = "extension_point" </ins> // Two modes supported in "churn" operator.

var ( defaultMetricsCollectorConfig = metricsCollectorConfig{ <del> Metrics: []string{ "scheduler_scheduling_algorithm_predicate_evaluation_seconds", "scheduler_scheduling_algorithm_priority_evaluation_seconds", "scheduler_e2e_scheduling_duration_seconds", "scheduler_pod_scheduling_duration_seconds", </del> <ins> Metrics: map[string]*labelValues{ "scheduler_framework_extension_point_duration_seconds": { label:  extensionPointsLabelName, values: []string{"Filter", "Score"}, }, "scheduler_e2e_scheduling_duration_seconds": nil, "scheduler_pod_scheduling_duration_seconds": nil, </ins> }, } )

return ioutil.WriteFile(destFile, b, 0644) } <ins> type labelValues struct { label  string values []string } </ins> // metricsCollectorConfig is the config to be marshalled to YAML config file. <ins> // NOTE: The mapping here means only one filter is supported, either value in the list of `values` is able to be collected. </ins> type metricsCollectorConfig struct { <del> Metrics []string </del> <ins> Metrics map[string]*labelValues </ins> } // metricsCollector collects metrics from legacyregistry.DefaultGatherer.Gather() endpoint.

func (pc *metricsCollector) collect() []DataItem { var dataItems []DataItem <del> for _, metric := range pc.Metrics { dataItem := collectHistogramVec(metric, pc.labels) if dataItem != nil { dataItems = append(dataItems, *dataItem) </del> <ins> for metric, labelVals := range pc.Metrics { // no filter is specified, aggregate all the metrics within the same metricFamily. if labelVals == nil { dataItem := collectHistogramVec(metric, pc.labels, nil) if dataItem != nil { dataItems = append(dataItems, *dataItem) } } else { // fetch the metric from metricFamily which match each of the lvMap. for _, value := range labelVals.values { lvMap := map[string]string{labelVals.label: value} dataItem := collectHistogramVec(metric, pc.labels, lvMap) if dataItem != nil { dataItems = append(dataItems, *dataItem) } } </ins> } } return dataItems } <del> func collectHistogramVec(metric string, labels map[string]string) *DataItem { vec, err := testutil.GetHistogramVecFromGatherer(legacyregistry.DefaultGatherer, metric, nil) </del> <ins> func collectHistogramVec(metric string, labels map[string]string, lvMap map[string]string) *DataItem { vec, err := testutil.GetHistogramVecFromGatherer(legacyregistry.DefaultGatherer, metric, lvMap) </ins> if err != nil { klog.Error(err) return nil

for k, v := range labels { labelMap[k] = v } <ins> for k, v := range lvMap { labelMap[k] = v } </ins> return &DataItem{ Labels: labelMap, Data: map[string]float64{