diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-02-25 20:47:21 +0100 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-03-08 09:22:42 +0100 |
commit | d0d084dd8ce37141e0a2f0e9def78ffbb613ab94 (patch) | |
tree | bd626d1310b64b2f5410a2ca8a7f5a7232634d2b /libpod | |
parent | 320df838810cbdb0f3dc0e2092f5ed04fc9b6e5d (diff) | |
download | podman-d0d084dd8ce37141e0a2f0e9def78ffbb613ab94.tar.gz podman-d0d084dd8ce37141e0a2f0e9def78ffbb613ab94.tar.bz2 podman-d0d084dd8ce37141e0a2f0e9def78ffbb613ab94.zip |
turn hidden --trace into a NOP
The --trace has helped in early stages analyze Podman code. However,
it's contributing to dependency and binary bloat. The standard go
tooling can also help in profiling, so let's turn `--trace` into a NOP.
[NO TESTS NEEDED]
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_api.go | 9 | ||||
-rw-r--r-- | libpod/container_internal.go | 29 | ||||
-rw-r--r-- | libpod/container_internal_linux.go | 5 | ||||
-rw-r--r-- | libpod/image/image.go | 15 | ||||
-rw-r--r-- | libpod/image/pull.go | 13 | ||||
-rw-r--r-- | libpod/runtime_ctr.go | 9 | ||||
-rw-r--r-- | libpod/storage.go | 5 |
7 files changed, 0 insertions, 85 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 6fa8b27cd..4ccb240e7 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -12,7 +12,6 @@ import ( "github.com/containers/podman/v3/libpod/define" "github.com/containers/podman/v3/libpod/events" "github.com/containers/podman/v3/pkg/signal" - "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -28,10 +27,6 @@ import ( // containers). The `recursive` parameter will, if set to true, start these // dependency containers before initializing this container. func (c *Container) Init(ctx context.Context, recursive bool) error { - span, _ := opentracing.StartSpanFromContext(ctx, "containerInit") - span.SetTag("struct", "container") - defer span.Finish() - if !c.batched { c.lock.Lock() defer c.lock.Unlock() @@ -84,10 +79,6 @@ func (c *Container) Init(ctx context.Context, recursive bool) error { // running before being run. The recursive parameter, if set, will start all // dependencies before starting this container. func (c *Container) Start(ctx context.Context, recursive bool) error { - span, _ := opentracing.StartSpanFromContext(ctx, "containerStart") - span.SetTag("struct", "container") - defer span.Finish() - if !c.batched { c.lock.Lock() defer c.lock.Unlock() diff --git a/libpod/container_internal.go b/libpod/container_internal.go index af57aaca0..1614211fb 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -33,7 +33,6 @@ import ( spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-tools/generate" "github.com/opencontainers/selinux/go-selinux/label" - "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -399,10 +398,6 @@ func (c *Container) setupStorageMapping(dest, from *storage.IDMappingOptions) { // Create container root filesystem for use func (c *Container) setupStorage(ctx context.Context) error { - span, _ := opentracing.StartSpanFromContext(ctx, "setupStorage") - span.SetTag("type", "container") - defer span.Finish() - if !c.valid { return errors.Wrapf(define.ErrCtrRemoved, "container %s is not valid", c.ID()) } @@ -1035,10 +1030,6 @@ func (c *Container) cniHosts() string { // Initialize a container, creating it in the runtime func (c *Container) init(ctx context.Context, retainRetries bool) error { - span, _ := opentracing.StartSpanFromContext(ctx, "init") - span.SetTag("struct", "container") - defer span.Finish() - // Unconditionally remove conmon temporary files. // We've been running into far too many issues where they block startup. if err := c.removeConmonFiles(); err != nil { @@ -1111,10 +1102,6 @@ func (c *Container) init(ctx context.Context, retainRetries bool) error { // Deletes the container in the runtime, and resets its state to Exited. // The container can be restarted cleanly after this. func (c *Container) cleanupRuntime(ctx context.Context) error { - span, _ := opentracing.StartSpanFromContext(ctx, "cleanupRuntime") - span.SetTag("struct", "container") - defer span.Finish() - // If the container is not ContainerStateStopped or // ContainerStateCreated, do nothing. if !c.ensureState(define.ContainerStateStopped, define.ContainerStateCreated) { @@ -1156,10 +1143,6 @@ func (c *Container) cleanupRuntime(ctx context.Context) error { // Not necessary for ContainerStateExited - the container has already been // removed from the runtime, so init() can proceed freely. func (c *Container) reinit(ctx context.Context, retainRetries bool) error { - span, _ := opentracing.StartSpanFromContext(ctx, "reinit") - span.SetTag("struct", "container") - defer span.Finish() - logrus.Debugf("Recreating container %s in OCI runtime", c.ID()) if err := c.cleanupRuntime(ctx); err != nil { @@ -1820,10 +1803,6 @@ func (c *Container) cleanupStorage() error { func (c *Container) cleanup(ctx context.Context) error { var lastError error - span, _ := opentracing.StartSpanFromContext(ctx, "cleanup") - span.SetTag("struct", "container") - defer span.Finish() - logrus.Debugf("Cleaning up container %s", c.ID()) // Remove healthcheck unit/timer file if it execs @@ -1884,10 +1863,6 @@ func (c *Container) cleanup(ctx context.Context) error { // delete deletes the container and runs any configured poststop // hooks. func (c *Container) delete(ctx context.Context) error { - span, _ := opentracing.StartSpanFromContext(ctx, "delete") - span.SetTag("struct", "container") - defer span.Finish() - if err := c.ociRuntime.DeleteContainer(c); err != nil { return errors.Wrapf(err, "error removing container %s from runtime", c.ID()) } @@ -1903,10 +1878,6 @@ func (c *Container) delete(ctx context.Context) error { // the OCI Runtime Specification (which requires them to run // post-delete, despite the stage name). func (c *Container) postDeleteHooks(ctx context.Context) error { - span, _ := opentracing.StartSpanFromContext(ctx, "postDeleteHooks") - span.SetTag("struct", "container") - defer span.Finish() - if c.state.ExtensionStageHooks != nil { extensionHooks, ok := c.state.ExtensionStageHooks["poststop"] if ok { diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 2684c2845..24319f4b5 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -49,7 +49,6 @@ import ( spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-tools/generate" "github.com/opencontainers/selinux/go-selinux/label" - "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" @@ -322,10 +321,6 @@ func (c *Container) getUserOverrides() *lookup.Overrides { // Generate spec for a container // Accepts a map of the container's dependencies func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "generateSpec") - span.SetTag("type", "container") - defer span.Finish() - overrides := c.getUserOverrides() execUser, err := lookup.GetUserGroupInfo(c.state.Mountpoint, c.config.User, overrides) if err != nil { diff --git a/libpod/image/image.go b/libpod/image/image.go index 8bbf555e3..12dc22360 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -38,7 +38,6 @@ import ( "github.com/containers/storage" digest "github.com/opencontainers/go-digest" ociv1 "github.com/opencontainers/image-spec/specs-go/v1" - opentracing "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -144,10 +143,6 @@ func (ir *Runtime) NewFromLocal(name string) (*Image, error) { // New creates a new image object where the image could be local // or remote func (ir *Runtime) New(ctx context.Context, name, signaturePolicyPath, authfile string, writer io.Writer, dockeroptions *DockerRegistryOptions, signingoptions SigningOptions, label *string, pullType util.PullType, progress chan types.ProgressProperties) (*Image, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "newImage") - span.SetTag("type", "runtime") - defer span.Finish() - // We don't know if the image is local or not ... check local first if pullType != util.PullImageAlways { newImage, err := ir.NewFromLocal(name) @@ -1297,21 +1292,11 @@ func (i *Image) inspect(ctx context.Context, calculateSize bool) (*inspect.Image // Inspect returns an image's inspect data func (i *Image) Inspect(ctx context.Context) (*inspect.ImageData, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "imageInspect") - - span.SetTag("type", "image") - defer span.Finish() - return i.inspect(ctx, true) } // InspectNoSize returns an image's inspect data without calculating the size for the image func (i *Image) InspectNoSize(ctx context.Context) (*inspect.ImageData, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "imageInspectNoSize") - - span.SetTag("type", "image") - defer span.Finish() - return i.inspect(ctx, false) } diff --git a/libpod/image/pull.go b/libpod/image/pull.go index c5fafc25d..58160b52f 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -23,7 +23,6 @@ import ( "github.com/containers/podman/v3/libpod/events" "github.com/containers/podman/v3/pkg/errorhandling" "github.com/containers/podman/v3/pkg/registries" - "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -172,9 +171,6 @@ func (ir *Runtime) getPullRefPairsFromDockerArchiveReference(ctx context.Context // pullGoalFromImageReference returns a pull goal for a single ImageReference, depending on the used transport. // Note that callers are responsible for invoking (*pullGoal).cleanUp() to clean up possibly open resources. func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types.ImageReference, imgName string, sc *types.SystemContext) (*pullGoal, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "pullGoalFromImageReference") - defer span.Finish() - // supports pulling from docker-archive, oci, and registries switch srcRef.Transport().Name() { case DockerArchive: @@ -243,9 +239,6 @@ func toLocalImageName(imageName string) string { // pullImageFromHeuristicSource pulls an image based on inputName, which is heuristically parsed and may involve configured registries. // Use pullImageFromReference if the source is known precisely. func (ir *Runtime) pullImageFromHeuristicSource(ctx context.Context, inputName string, writer io.Writer, authfile, signaturePolicyPath string, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, retryOptions *retry.RetryOptions, label *string, progress chan types.ProgressProperties) ([]string, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "pullImageFromHeuristicSource") - defer span.Finish() - var goal *pullGoal sc := GetSystemContext(signaturePolicyPath, authfile, false) if dockerOptions != nil { @@ -281,9 +274,6 @@ func (ir *Runtime) pullImageFromHeuristicSource(ctx context.Context, inputName s // pullImageFromReference pulls an image from a types.imageReference. func (ir *Runtime) pullImageFromReference(ctx context.Context, srcRef types.ImageReference, writer io.Writer, authfile, signaturePolicyPath string, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, retryOptions *retry.RetryOptions) ([]string, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "pullImageFromReference") - defer span.Finish() - sc := GetSystemContext(signaturePolicyPath, authfile, false) if dockerOptions != nil { sc.OSChoice = dockerOptions.OSChoice @@ -306,9 +296,6 @@ func cleanErrorMessage(err error) string { // doPullImage is an internal helper interpreting pullGoal. Almost everyone should call one of the callers of doPullImage instead. func (ir *Runtime) doPullImage(ctx context.Context, sc *types.SystemContext, goal pullGoal, writer io.Writer, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, retryOptions *retry.RetryOptions, label *string, progress chan types.ProgressProperties) ([]string, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "doPullImage") - defer span.Finish() - policyContext, err := getPolicyContext(sc) if err != nil { return nil, err diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 301c4627d..661ca7ff8 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -22,7 +22,6 @@ import ( "github.com/docker/go-units" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-tools/generate" - "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -179,10 +178,6 @@ func (r *Runtime) initContainerVariables(rSpec *spec.Spec, config *ContainerConf } func (r *Runtime) newContainer(ctx context.Context, rSpec *spec.Spec, options ...CtrCreateOption) (*Container, error) { - span, _ := opentracing.StartSpanFromContext(ctx, "newContainer") - span.SetTag("type", "runtime") - defer span.Finish() - ctr, err := r.initContainerVariables(rSpec, nil) if err != nil { return nil, errors.Wrapf(err, "error initializing container variables") @@ -472,10 +467,6 @@ func (r *Runtime) RemoveContainer(ctx context.Context, c *Container, force bool, // infra container protections, and *not* remove from the database (as pod // remove will handle that). func (r *Runtime) removeContainer(ctx context.Context, c *Container, force, removeVolume, removePod bool) error { - span, _ := opentracing.StartSpanFromContext(ctx, "removeContainer") - span.SetTag("type", "runtime") - defer span.Finish() - if !c.valid { if ok, _ := r.state.HasContainer(c.ID()); !ok { // Container probably already removed diff --git a/libpod/storage.go b/libpod/storage.go index 418eb3151..4aa42dc8e 100644 --- a/libpod/storage.go +++ b/libpod/storage.go @@ -10,7 +10,6 @@ import ( "github.com/containers/storage" "github.com/containers/storage/pkg/idtools" v1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -67,10 +66,6 @@ func (metadata *RuntimeContainerMetadata) SetMountLabel(mountLabel string) { // CreateContainerStorage creates the storage end of things. We already have the container spec created // TO-DO We should be passing in an Image object in the future. func (r *storageService) CreateContainerStorage(ctx context.Context, systemContext *types.SystemContext, imageName, imageID, containerName, containerID string, options storage.ContainerOptions) (_ ContainerInfo, retErr error) { - span, _ := opentracing.StartSpanFromContext(ctx, "createContainerStorage") - span.SetTag("type", "storageService") - defer span.Finish() - var imageConfig *v1.Image if imageName != "" { var ref types.ImageReference |