Skip to content

Commit 3f75af7

Browse files
committed
Move certain debug logs to trace logs
Signed-off-by: Kirtana Ashok <[email protected]> (cherry picked from commit f261969)
1 parent 7c3aca7 commit 3f75af7

6 files changed

Lines changed: 19 additions & 18 deletions

File tree

cmd/ctr/commands/content/content.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ var (
424424

425425
ctx = log.WithLogger(ctx, log.G(ctx).WithField("ref", ref))
426426

427-
log.G(ctx).Debugf("resolving")
427+
log.G(ctx).Tracef("resolving")
428428
name, desc, err := resolver.Resolve(ctx, ref)
429429
if err != nil {
430430
return err
@@ -434,7 +434,7 @@ var (
434434
return err
435435
}
436436

437-
log.G(ctx).Debugf("fetching")
437+
log.G(ctx).Tracef("fetching")
438438
rc, err := fetcher.Fetch(ctx, desc)
439439
if err != nil {
440440
return err
@@ -470,7 +470,7 @@ var (
470470

471471
ctx = log.WithLogger(ctx, log.G(ctx).WithField("ref", ref))
472472

473-
log.G(ctx).Debugf("resolving")
473+
log.G(ctx).Tracef("resolving")
474474
fetcher, err := resolver.Fetcher(ctx, ref)
475475
if err != nil {
476476
return err
@@ -529,7 +529,7 @@ var (
529529

530530
ctx = log.WithLogger(ctx, log.G(ctx).WithField("ref", ref))
531531

532-
log.G(ctx).Debugf("resolving")
532+
log.G(ctx).Tracef("resolving")
533533
pusher, err := resolver.Pusher(ctx, ref)
534534
if err != nil {
535535
return err

gc/scheduler/scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ func (s *gcScheduler) run(ctx context.Context) {
328328

329329
gcTime := stats.Elapsed()
330330
gcTimeHist.Update(gcTime)
331-
log.G(ctx).WithField("d", gcTime).Debug("garbage collected")
331+
log.G(ctx).WithField("d", gcTime).Trace("garbage collected")
332332
gcTimeSum += gcTime
333333
collections++
334334
collectionCounter.WithValues("success").Inc()

metadata/db.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ func (m *DB) cleanupSnapshotter(ctx context.Context, name string) (time.Duration
520520
if err != nil {
521521
logger.WithError(err).Warn("snapshot garbage collection failed")
522522
} else {
523-
logger.WithField("d", d).Debugf("snapshot garbage collected")
523+
logger.WithField("d", d).Tracef("snapshot garbage collected")
524524
}
525525
return d, err
526526
}
@@ -535,7 +535,7 @@ func (m *DB) cleanupContent(ctx context.Context) (time.Duration, error) {
535535
if err != nil {
536536
log.G(ctx).WithError(err).Warn("content garbage collection failed")
537537
} else {
538-
log.G(ctx).WithField("d", d).Debugf("content garbage collected")
538+
log.G(ctx).WithField("d", d).Tracef("content garbage collected")
539539
}
540540

541541
return d, err

pkg/cri/instrument/instrumented_service.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ func (in *instrumentedService) ExecSync(ctx context.Context, r *runtime.ExecSync
768768
if err != nil {
769769
log.G(ctx).WithError(err).Errorf("ExecSync for %q failed", r.GetContainerId())
770770
} else {
771-
log.G(ctx).Debugf("ExecSync for %q returns with exit code %d", r.GetContainerId(), res.GetExitCode())
771+
log.G(ctx).Tracef("ExecSync for %q returns with exit code %d", r.GetContainerId(), res.GetExitCode())
772772
}
773773
}()
774774
res, err = in.c.ExecSync(ctrdutil.WithNamespace(ctx), r)
@@ -1221,12 +1221,12 @@ func (in *instrumentedService) ImageFsInfo(ctx context.Context, r *runtime.Image
12211221
}
12221222
ctx, span := tracing.StartSpan(ctx, tracing.Name(criSpanPrefix, "ImageFsInfo"))
12231223
defer span.End()
1224-
log.G(ctx).Debugf("ImageFsInfo")
1224+
log.G(ctx).Tracef("ImageFsInfo")
12251225
defer func() {
12261226
if err != nil {
12271227
log.G(ctx).WithError(err).Error("ImageFsInfo failed")
12281228
} else {
1229-
log.G(ctx).Debugf("ImageFsInfo returns filesystem info %+v", res.ImageFilesystems)
1229+
log.G(ctx).Tracef("ImageFsInfo returns filesystem info %+v", res.ImageFilesystems)
12301230
}
12311231
span.SetStatus(err)
12321232
}()
@@ -1278,12 +1278,12 @@ func (in *instrumentedService) PodSandboxStats(ctx context.Context, r *runtime.P
12781278
if err := in.checkInitialized(); err != nil {
12791279
return nil, err
12801280
}
1281-
log.G(ctx).Debugf("PodSandboxStats for %q", r.GetPodSandboxId())
1281+
log.G(ctx).Tracef("PodSandboxStats for %q", r.GetPodSandboxId())
12821282
defer func() {
12831283
if err != nil {
12841284
log.G(ctx).WithError(err).Errorf("PodSandboxStats for %q failed", r.GetPodSandboxId())
12851285
} else {
1286-
log.G(ctx).Debugf("PodSandboxStats for %q returns stats %+v", r.GetPodSandboxId(), res.GetStats())
1286+
log.G(ctx).Tracef("PodSandboxStats for %q returns stats %+v", r.GetPodSandboxId(), res.GetStats())
12871287
}
12881288
}()
12891289
res, err = in.c.PodSandboxStats(ctrdutil.WithNamespace(ctx), r)
@@ -1331,12 +1331,12 @@ func (in *instrumentedService) ContainerStats(ctx context.Context, r *runtime.Co
13311331
if err := in.checkInitialized(); err != nil {
13321332
return nil, err
13331333
}
1334-
log.G(ctx).Debugf("ContainerStats for %q", r.GetContainerId())
1334+
log.G(ctx).Tracef("ContainerStats for %q", r.GetContainerId())
13351335
defer func() {
13361336
if err != nil {
13371337
log.G(ctx).WithError(err).Errorf("ContainerStats for %q failed", r.GetContainerId())
13381338
} else {
1339-
log.G(ctx).Debugf("ContainerStats for %q returns stats %+v", r.GetContainerId(), res.GetStats())
1339+
log.G(ctx).Tracef("ContainerStats for %q returns stats %+v", r.GetContainerId(), res.GetStats())
13401340
}
13411341
}()
13421342
res, err = in.c.ContainerStats(ctrdutil.WithNamespace(ctx), r)
@@ -1721,7 +1721,7 @@ func (in *instrumentedService) ListMetricDescriptors(ctx context.Context, r *run
17211721
if err != nil {
17221722
log.G(ctx).WithError(err).Errorf("ListMetricDescriptors failed, error")
17231723
} else {
1724-
log.G(ctx).Debug("ListMetricDescriptors returns successfully")
1724+
log.G(ctx).Trace("ListMetricDescriptors returns successfully")
17251725
}
17261726
}()
17271727

@@ -1738,7 +1738,7 @@ func (in *instrumentedService) ListPodSandboxMetrics(ctx context.Context, r *run
17381738
if err != nil {
17391739
log.G(ctx).WithError(err).Errorf("ListPodSandboxMetrics failed, error")
17401740
} else {
1741-
log.G(ctx).Debug("ListPodSandboxMetrics returns successfully")
1741+
log.G(ctx).Trace("ListPodSandboxMetrics returns successfully")
17421742
}
17431743
}()
17441744

pkg/cri/io/logger.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/sirupsen/logrus"
2727
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
2828

29+
"github.com/containerd/containerd/log"
2930
cioutil "github.com/containerd/containerd/pkg/ioutil"
3031
)
3132

@@ -167,7 +168,7 @@ func redirectLogs(path string, rc io.ReadCloser, w io.Writer, s StreamType, maxL
167168
}
168169
if err != nil {
169170
if err == io.EOF {
170-
logrus.Debugf("Getting EOF from stream %q while redirecting to log file %q", s, path)
171+
log.L.Tracef("Getting EOF from stream %q while redirecting to log file %q", s, path)
171172
} else {
172173
logrus.WithError(err).Errorf("An error occurred when redirecting stream %q to log file %q", s, path)
173174
}

pkg/cri/server/container_execsync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func drainExecSyncIO(ctx context.Context, execProcess containerd.Process, drainE
293293
select {
294294
case <-timerCh:
295295
case <-attachDone:
296-
log.G(ctx).Debugf("Stream pipe for exec process %q done", execProcess.ID())
296+
log.G(ctx).Tracef("Stream pipe for exec process %q done", execProcess.ID())
297297
return nil
298298
}
299299

0 commit comments

Comments
 (0)