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 some klog typo #543

Merged
merged 1 commit into from
Sep 6, 2022
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 cmd/craned/app/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ func Run(ctx context.Context, opts *options.Options) error {
LeaderElectionNamespace: known.CraneSystemNamespace,
})
if err != nil {
klog.Error(err, "unable to start crane manager")
klog.ErrorS(err, "unable to start crane manager")
return err
}

if err := mgr.AddHealthzCheck("ping", healthz.Ping); err != nil {
klog.Error(err, "failed to add health check endpoint")
klog.ErrorS(err, "failed to add health check endpoint")
return err
}
// initialize data sources and predictor
Expand All @@ -119,7 +119,7 @@ func Run(ctx context.Context, opts *options.Options) error {

recommenders, err := initRecommenders(opts)
if err != nil {
klog.Error(err, "failed to init recommenders")
klog.ErrorS(err, "failed to init recommenders")
return err
}
recommenderMgr := initRecommenderManager(recommenders, realtimeDataSources, historyDataSources)
Expand Down Expand Up @@ -396,7 +396,7 @@ func runAll(ctx context.Context, mgr ctrl.Manager, predictorMgr predictor.Manage

eg.Go(func() error {
if err := mgr.Start(ctx); err != nil {
klog.Error(err, "problem running crane manager")
klog.ErrorS(err, "problem running crane manager")
klog.Exit(err)
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/metric-adapter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func main() {

klog.Infof(cmd.Message)
if err := cmd.Run(ctx.Done()); err != nil {
klog.Error(err, "Failed to run metrics adapter")
klog.ErrorS(err, "Failed to run metrics adapter")
os.Exit(1)
}
}
2 changes: 1 addition & 1 deletion pkg/controller/ehpa/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (c *EffectiveHPAController) ReconcileHPA(ctx context.Context, ehpa *autosca
return c.CreateHPA(ctx, ehpa, substitute, tsp)
} else {
c.Recorder.Event(ehpa, v1.EventTypeNormal, "FailedGetHPA", err.Error())
klog.Error("Failed to get HPA, ehpa %s error %v", klog.KObj(ehpa), err)
klog.Errorf("Failed to get HPA, ehpa %s error %v", klog.KObj(ehpa), err)
return nil, err
}
} else if len(hpaList.Items) == 0 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/metricprovider/custom_metric_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func IsLocalCustomMetric(metricInfo provider.CustomMetricInfo, client client.Cli
func GetPrediction(ctx context.Context, kubeclient client.Client, namespace string, metricSelector labels.Selector) (*predictionapi.TimeSeriesPrediction, error) {
labelSelector, err := labels.ConvertSelectorToLabelsMap(metricSelector.String())
if err != nil {
klog.Error(err, "Failed to convert metric selectors to labels")
klog.ErrorS(err, "Failed to convert metric selectors to labels")
return nil, err
}

Expand Down Expand Up @@ -250,7 +250,7 @@ func GetPrediction(ctx context.Context, kubeclient client.Client, namespace stri
func (p *CustomMetricProvider) GetPods(ctx context.Context, namespace string, selector labels.Selector) ([]v1.Pod, error) {
labelSelector, err := labels.ConvertSelectorToLabelsMap(selector.String())
if err != nil {
klog.Error(err, "Failed to convert selectors to labels")
klog.ErrorS(err, "Failed to convert selectors to labels")
return nil, err
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/metrics/tsp_metric_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (c *TspMetricCollector) Collect(ch chan<- prometheus.Metric) {
tspList := &predictionapi.TimeSeriesPredictionList{}
err := c.List(context.TODO(), tspList)
if err != nil {
klog.Error(err, "Collect metrics failed")
klog.ErrorS(err, "Collect metrics failed")
return
}
for _, tsp := range tspList.Items {
Expand Down Expand Up @@ -123,7 +123,7 @@ func (c *TspMetricCollector) computePredictionMetric(tsp *predictionapi.TimeSeri
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 resource metric cpu or memory.
Expand Down Expand Up @@ -155,7 +155,7 @@ func (c *TspMetricCollector) computePredictionMetric(tsp *predictionapi.TimeSeri

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 @@ -166,7 +166,7 @@ func (c *TspMetricCollector) computePredictionMetric(tsp *predictionapi.TimeSeri
}

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

Expand Down