Skip to content

Commit

Permalink
don't print on --tp-export (#77)
Browse files Browse the repository at this point in the history
--tp-export also works with --tp-carrier now so fix that to not
accidentally print which breaks things for people redirecting scripts
and is Not Good.

Signed-off-by: Amy Tobey <atobey@equinix.com>
  • Loading branch information
Amy Tobey authored Sep 10, 2021
1 parent f4bbca3 commit 3ddb598
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions cmd/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,14 @@ func GetExitCode() int {
func propagateOtelCliSpan(ctx context.Context, span trace.Span, target io.Writer) {
saveTraceparentToFile(ctx, config.TraceparentCarrierFile)

// --tp-print / --tp-export
if !config.TraceparentPrint && !config.TraceparentPrintExport {
return
}
if config.TraceparentPrint {
sc := trace.SpanContextFromContext(ctx)
traceId := sc.TraceID().String()
spanId := sc.SpanID().String()

sc := trace.SpanContextFromContext(ctx)
traceId := sc.TraceID().String()
spanId := sc.SpanID().String()

tp := getTraceparent(ctx)
printSpanData(target, traceId, spanId, tp)
tp := getTraceparent(ctx)
printSpanData(target, traceId, spanId, tp)
}
}

// printSpanData takes the provided strings and prints them in a consitent format,
Expand Down

0 comments on commit 3ddb598

Please sign in to comment.