Skip to content

Commit

Permalink
include trace id when --debug is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pmenglund committed Nov 6, 2023
1 parent 340e71c commit 4efe3ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Empty file added cmd/testdata/query_lambda.sql
Empty file.
12 changes: 12 additions & 0 deletions cmd/testdata/query_lambda_updated.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SELECT
COUNT(e.type) AS type_cnt,
COUNT(e.kind) AS kind_cnt,
e.label
FROM
commons._events e
GROUP BY
e.label
ORDER BY
type_cnt DESC,
kind_cnt DESC,
e.label
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"github.com/rockset/cli/flag"
"os"
"os/signal"
"runtime/debug"
Expand Down Expand Up @@ -75,6 +76,10 @@ func main() {
var re rockerr.Error
if errors.As(err, &re) {
_, _ = fmt.Fprintf(os.Stderr, "%s\n", tui.RocksetStyle.Render("Rockset error:", err.Error()))
dbg, _ := root.PersistentFlags().GetBool(flag.Debug)
if id := re.GetTraceId(); id != "" && dbg {
_, _ = fmt.Fprintf(os.Stderr, "%s\n", tui.RocksetStyle.Render("Trace ID:", id))
}
} else {
// this captures usage errors too, as there is no way to distinguish it from other errors
sentry.CaptureException(err)
Expand Down

0 comments on commit 4efe3ad

Please sign in to comment.