runtime: Fix trace span ordering

Return ctx in trace() functions to correct span ordering.

Fixes #1550

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
This commit is contained in:
Chelsea Mafrica
2021-03-25 10:42:25 -07:00
parent 5b5b5cc611
commit f3ebbb1f1a
10 changed files with 52 additions and 52 deletions

View File

@@ -53,7 +53,7 @@ func SetLogger(ctx context.Context, logger *logrus.Entry) {
// CreateSandbox is the virtcontainers sandbox creation entry point.
// CreateSandbox creates a sandbox and its containers. It does not start them.
func CreateSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factory) (VCSandbox, error) {
span, _ := trace(ctx, "CreateSandbox")
span, ctx := trace(ctx, "CreateSandbox")
defer span.End()
s, err := createSandboxFromConfig(ctx, sandboxConfig, factory)
@@ -62,7 +62,7 @@ func CreateSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Fac
}
func createSandboxFromConfig(ctx context.Context, sandboxConfig SandboxConfig, factory Factory) (_ *Sandbox, err error) {
span, _ := trace(ctx, "createSandboxFromConfig")
span, ctx := trace(ctx, "createSandboxFromConfig")
defer span.End()
// Create the sandbox.
@@ -136,7 +136,7 @@ func createSandboxFromConfig(ctx context.Context, sandboxConfig SandboxConfig, f
// in the sandbox left, do stop the sandbox and delete it. Those serial operations will be done exclusively by
// locking the sandbox.
func CleanupContainer(ctx context.Context, sandboxID, containerID string, force bool) error {
span, _ := trace(ctx, "CleanupContainer")
span, ctx := trace(ctx, "CleanupContainer")
defer span.End()
if sandboxID == "" {