Skip to content

Commit

Permalink
fixing nesting
Browse files Browse the repository at this point in the history
Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>
  • Loading branch information
nitishchauhan0022 committed Aug 19, 2023
1 parent 4cb6c8d commit df81586
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/porter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)

var includeDocsCommand = false
Expand Down Expand Up @@ -187,7 +188,16 @@ Try our QuickStart https://getporter.org/quickstart to learn how to use Porter.

// Reload configuration with the now parsed cli flags
p.DataLoader = cli.LoadHierarchicalConfig(cmd)
_, err := p.Connect(cmd.Context())
ctx, err := p.Connect(cmd.Context())

// Extract the parent span from the main command
parentSpan := trace.SpanFromContext(cmd.Context())

// Create a context with the main command's span
ctxWithRootCmdSpan := trace.ContextWithSpan(ctx, parentSpan)

// Set the new context to the command
cmd.SetContext(ctxWithRootCmdSpan)
return err
},
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down

0 comments on commit df81586

Please sign in to comment.