libnet: add more OTel spans

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton
2024-04-22 07:07:15 +02:00
parent 224d7291df
commit 19f72d6fc4
7 changed files with 81 additions and 27 deletions

View File

@@ -12,6 +12,9 @@ import (
"github.com/docker/docker/internal/compatcontext"
"github.com/docker/docker/libcontainerd"
"github.com/pkg/errors"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)
// validateState verifies if the container is in a non-conflicting state.
@@ -67,6 +70,11 @@ func (daemon *Daemon) ContainerStart(ctx context.Context, name string, checkpoin
// between containers. The container is left waiting for a signal to
// begin running.
func (daemon *Daemon) containerStart(ctx context.Context, daemonCfg *configStore, container *container.Container, checkpoint string, checkpointDir string, resetRestartManager bool) (retErr error) {
ctx, span := otel.Tracer("").Start(ctx, "daemon.containerStart", trace.WithAttributes(
attribute.String("container.ID", container.ID),
attribute.String("container.Name", container.Name)))
defer span.End()
start := time.Now()
container.Lock()
defer container.Unlock()