From 077b77c178c929caabb0ce942f1a7b3eabe13833 Mon Sep 17 00:00:00 2001 From: Chelsea Mafrica Date: Thu, 16 Sep 2021 16:14:32 -0700 Subject: [PATCH] runtime: tracing: Fix logger passed in newContainer Change logger in Trace call in newContainer from sandbox.Logger() to nil. Passing nil will cause an error to be logged by kataTraceLogger instead of the sandbox logger, which will avoid having the log message report it as part of the sandbox subsystem when it is part of the container subsystem. The kataTraceLogger will not log it as related to the container subsystem, but since the container logger has not been created at this point, and we already use the kataTraceLogger in other instances where a subsystem's logger has not been created yet, this PR makes the call consistent with other code. Fixes #2665 Signed-off-by: Chelsea Mafrica --- src/runtime/virtcontainers/container.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/virtcontainers/container.go b/src/runtime/virtcontainers/container.go index 85144e9626..b1d17d18db 100644 --- a/src/runtime/virtcontainers/container.go +++ b/src/runtime/virtcontainers/container.go @@ -738,7 +738,7 @@ func (c *Container) initConfigResourcesMemory() { // newContainer creates a Container structure from a sandbox and a container configuration. func newContainer(ctx context.Context, sandbox *Sandbox, contConfig *ContainerConfig) (*Container, error) { - span, ctx := katatrace.Trace(ctx, sandbox.Logger(), "newContainer", containerTracingTags, map[string]string{"container_id": contConfig.ID, "sandbox_id": sandbox.id}) + span, ctx := katatrace.Trace(ctx, nil, "newContainer", containerTracingTags, map[string]string{"container_id": contConfig.ID, "sandbox_id": sandbox.id}) defer span.End() if !contConfig.valid() {