From 62a636a9f6e9cc82b96b654df8f2ffd10c4e0271 Mon Sep 17 00:00:00 2001 From: Priti Desai Date: Wed, 6 Sep 2023 20:54:28 -0700 Subject: [PATCH] converting a few info into debug message A taskRun/pipelineRun is watched as soon as created. Until the run is complete and ready to proceed further, the chains controller is logging that the taskRun/pipelineRun is still running at the info level. This looks good but generates a lot of info in the controller logs and exponentially increases with the number of taskRun and pipelineRun. Converting such message to be reported at the debug log level. Formatting a few error message such that the namespace/name is enclosed with parenthesis so that its easy to read. Signed-off-by: Priti Desai --- pkg/reconciler/pipelinerun/pipelinerun.go | 14 +++++++------- pkg/reconciler/taskrun/taskrun.go | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index 069aa80d36..1bdbf3223c 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -59,14 +59,14 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, pr *v1beta1.PipelineRun) func (r *Reconciler) FinalizeKind(ctx context.Context, pr *v1beta1.PipelineRun) pkgreconciler.Event { // Check to make sure the PipelineRun is finished. if !pr.IsDone() { - logging.FromContext(ctx).Infof("pipelinerun is still running") + logging.FromContext(ctx).Debugf("pipelinerun \"%s/%s\" is still running", pr.Namespace, pr.Name) return nil } pro := objects.NewPipelineRunObject(pr) // Check to see if it has already been signed. if signing.Reconciled(ctx, r.Pipelineclientset, pro) { - logging.FromContext(ctx).Infof("pipelinerun has been reconciled") + logging.FromContext(ctx).Infof("pipelinerun \"%s/%s\" has been reconciled", pr.Namespace, pr.Name) return nil } @@ -78,7 +78,7 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, pr *v1beta1.PipelineRun) // has exceeded. Wait to process the PipelineRun on the next update, see // https://github.com/tektoncd/pipeline/issues/4916 if ptrs.Status == nil || ptrs.Status.CompletionTime == nil { - logging.FromContext(ctx).Infof("taskrun %s within pipelinerun is not yet finalized: embedded status is not complete", trName) + logging.FromContext(ctx).Infof("taskrun \"%s\" within pipelinerun \"%s\" is not yet finalized: embedded status is not complete", trName, pr.Name) return nil } trs = append(trs, trName) @@ -95,7 +95,7 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, pr *v1beta1.PipelineRun) for _, name := range trs { tr, err := r.TaskRunLister.TaskRuns(pr.Namespace).Get(name) if err != nil { - logging.FromContext(ctx).Errorf("Unable to get reconciled status of taskrun %s within pipelinerun", name) + logging.FromContext(ctx).Errorf("Unable to get reconciled status of taskrun \"%s\" within pipelinerun \"%s\"", name, pr.Name) if errors.IsNotFound(err) { // Since this is an unrecoverable scenario, returning the error would prevent the // finalizer from being removed, thus preventing the PipelineRun from being deleted. @@ -104,16 +104,16 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, pr *v1beta1.PipelineRun) return err } if tr == nil { - logging.FromContext(ctx).Infof("taskrun %s within pipelinerun is not found", name) + logging.FromContext(ctx).Infof("taskrun \"%s\" within pipelinerun \"%s\" is not found", name, pr.Name) return nil } if tr.Status.CompletionTime == nil { - logging.FromContext(ctx).Infof("taskrun %s within pipelinerun is not yet finalized: status is not complete", name) + logging.FromContext(ctx).Infof("taskrun \"%s\" within pipelinerun \"%s\" is not yet finalized: status is not complete", name, pr.Name) return r.trackTaskRun(tr, pr) } reconciled := signing.Reconciled(ctx, r.Pipelineclientset, objects.NewTaskRunObject(tr)) if !reconciled { - logging.FromContext(ctx).Infof("taskrun %s within pipelinerun is not yet reconciled", name) + logging.FromContext(ctx).Infof("taskrun \"%s\" within pipelinerun \"%s\" is not yet reconciled", name, pr.Name) return r.trackTaskRun(tr, pr) } pro.AppendTaskRun(tr) diff --git a/pkg/reconciler/taskrun/taskrun.go b/pkg/reconciler/taskrun/taskrun.go index 18fa87d15b..a4b75d04fe 100644 --- a/pkg/reconciler/taskrun/taskrun.go +++ b/pkg/reconciler/taskrun/taskrun.go @@ -52,7 +52,7 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tr *v1beta1.TaskRun) pkg func (r *Reconciler) FinalizeKind(ctx context.Context, tr *v1beta1.TaskRun) pkgreconciler.Event { // Check to make sure the TaskRun is finished. if !tr.IsDone() { - logging.FromContext(ctx).Infof("taskrun %s/%s is still running", tr.Namespace, tr.Name) + logging.FromContext(ctx).Debugf("taskrun \"%s/%s\" is still running", tr.Namespace, tr.Name) return nil } @@ -60,7 +60,7 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, tr *v1beta1.TaskRun) pkgr // Check to see if it has already been signed. if signing.Reconciled(ctx, r.Pipelineclientset, obj) { - logging.FromContext(ctx).Infof("taskrun %s/%s has been reconciled", tr.Namespace, tr.Name) + logging.FromContext(ctx).Infof("taskrun \"%s/%s\" has been reconciled", tr.Namespace, tr.Name) return nil }