pkg/process: support json trace output (#2713)

Change-Id: Id5a83a8fe23d19d92f5c2622acb0642b4e8f72a2
This commit is contained in:
JT Olio 2019-08-05 12:28:41 -06:00 committed by GitHub
parent 21a3bf89ee
commit 538e8168a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -268,7 +268,11 @@ func cleanup(cmd *cobra.Command) {
if err != nil {
return err
}
err = present.SpansToSVG(fh, collect.CollectSpans(ctx, work))
if strings.HasSuffix(*traceOut, ".json") {
err = present.SpansToJSON(fh, collect.CollectSpans(ctx, work))
} else {
err = present.SpansToSVG(fh, collect.CollectSpans(ctx, work))
}
err = errs.Combine(err, fh.Close())
if err != nil {
logger.Error("failed to write svg", zap.Error(err))