summaryrefslogtreecommitdiff
path: root/libpod/image
diff options
context:
space:
mode:
authorSebastian Jug <sejug@redhat.com>2018-10-16 16:30:53 -0400
committerSebastian Jug <seb@stianj.ug>2019-02-18 09:57:08 -0500
commit7141f972700ed454438d8539dd0bec79c0b61cf4 (patch)
treebfa2e524b71757a514a02ef68661b46dca9a3dfe /libpod/image
parente738ef16225395f5f5e4b93ba1a43ae9449ae11b (diff)
downloadpodman-7141f972700ed454438d8539dd0bec79c0b61cf4.tar.gz
podman-7141f972700ed454438d8539dd0bec79c0b61cf4.tar.bz2
podman-7141f972700ed454438d8539dd0bec79c0b61cf4.zip
OpenTracing support added to start, stop, run, create, pull, and ps
Drop context.Context field from cli.Context Signed-off-by: Sebastian Jug <sejug@redhat.com>
Diffstat (limited to 'libpod/image')
-rw-r--r--libpod/image/image.go9
-rw-r--r--libpod/image/pull.go13
2 files changed, 22 insertions, 0 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go
index 739372e77..028a795ea 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -27,6 +27,7 @@ import (
"github.com/containers/storage/pkg/reexec"
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"
)
@@ -126,6 +127,10 @@ 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, forcePull bool, label *string) (*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
newImage := Image{
InputName: name,
@@ -805,6 +810,10 @@ func (i *Image) imageInspectInfo(ctx context.Context) (*types.ImageInspectInfo,
// 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()
+
ociv1Img, err := i.ociv1Image(ctx)
if err != nil {
return nil, err
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 6fef96e37..6b9f7fc67 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -19,6 +19,7 @@ import (
"github.com/containers/image/types"
"github.com/containers/libpod/pkg/registries"
multierror "github.com/hashicorp/go-multierror"
+ opentracing "github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -109,6 +110,9 @@ func (ir *Runtime) getSinglePullRefPairGoal(srcRef types.ImageReference, destNam
// pullGoalFromImageReference returns a pull goal for a single ImageReference, depending on the used transport.
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:
@@ -194,6 +198,9 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types.
// 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, label *string) ([]string, error) {
+ span, _ := opentracing.StartSpanFromContext(ctx, "pullImageFromHeuristicSource")
+ defer span.Finish()
+
var goal *pullGoal
sc := GetSystemContext(signaturePolicyPath, authfile, false)
srcRef, err := alltransports.ParseImageName(inputName)
@@ -214,6 +221,9 @@ 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) ([]string, error) {
+ span, _ := opentracing.StartSpanFromContext(ctx, "pullImageFromReference")
+ defer span.Finish()
+
sc := GetSystemContext(signaturePolicyPath, authfile, false)
goal, err := ir.pullGoalFromImageReference(ctx, srcRef, transports.ImageName(srcRef), sc)
if err != nil {
@@ -224,6 +234,9 @@ func (ir *Runtime) pullImageFromReference(ctx context.Context, srcRef types.Imag
// 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, label *string) ([]string, error) {
+ span, _ := opentracing.StartSpanFromContext(ctx, "doPullImage")
+ defer span.Finish()
+
policyContext, err := getPolicyContext(sc)
if err != nil {
return nil, err