Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix klog error #673

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/metrics/metric_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (c *CraneMetricCollector) Collect(ch chan<- prometheus.Metric) {

err := c.Get(context.TODO(), client.ObjectKey{Namespace: namespace, Name: tspName}, &tsp)
if err != nil {
klog.Error("Failed to get tsp: %v", err)
klog.Errorf("Failed to get tsp: %v", err)
return
}
metricListTsp := c.getMetricsTsp(&tsp)
Expand Down Expand Up @@ -194,7 +194,7 @@ func (c *CraneMetricCollector) computePredictionMetric(tsp *predictionapi.TimeSe
ts := time.Unix(v.Timestamp, 0)
value, err := strconv.ParseFloat(v.Value, 64)
if err != nil {
klog.Error(err, "Failed to parse sample value", "value", value)
klog.ErrorS(err, "Failed to parse sample value", "value", value)
continue
}
//collect model metric of tsp for Prediction
Expand All @@ -221,7 +221,7 @@ func (c *CraneMetricCollector) computePredictionMetric(tsp *predictionapi.TimeSe

valueFloat, err := strconv.ParseFloat(v.Value, 32)
if err != nil {
klog.Error(err, "Failed to parse sample value", "value", v.Value)
klog.ErrorS(err, "Failed to parse sample value", "value", v.Value)
continue
}

Expand All @@ -232,7 +232,7 @@ func (c *CraneMetricCollector) computePredictionMetric(tsp *predictionapi.TimeSe
}

if !hasValidSample {
klog.Error("TimeSeries is outdated, ResourceIdentifier name %s", status.ResourceIdentifier)
klog.Errorf("TimeSeries is outdated, ResourceIdentifier name %s", status.ResourceIdentifier)
return predictionMetrics
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/recommendation/recommender/resource/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ func NewResourceRecommender(recommender apis.Recommender, recommendationRule ana
if err != nil {
return nil, err
}
specificationCofig, exists := recommender.Config["specification-config"]
specificationConfig, exists := recommender.Config["specification-config"]
if !exists {
specificationCofig = DefaultSpecs
specificationConfig = DefaultSpecs
}
specifications, err := GetResourceSpecifications(specificationCofig)
specifications, err := GetResourceSpecifications(specificationConfig)
if err != nil {
return nil, err
}
Expand Down