Skip to content

Commit

Permalink
report: rework the composition to use redacted verbose printouts
Browse files Browse the repository at this point in the history
This commit changes the composition of Sentry reports to include a
redacted verbose printout of the error at the beginning of the main
Message field.

This ensures that error objects with more complex printouts than just
safe detail strings get spelled out more clearly in the sentry
reports.

One example of this is that the tree structure of errors included
behind barriers (e.g. that included behind
errors.NewAssertionErrorWithWrappedErrf) is preserved in the sentry
printout.
  • Loading branch information
knz committed Mar 4, 2022
1 parent 7d46ef1 commit cc2568c
Show file tree
Hide file tree
Showing 15 changed files with 10,510 additions and 4,519 deletions.
308 changes: 219 additions & 89 deletions fmttests/testdata/format/leaves

Large diffs are not rendered by default.

351 changes: 256 additions & 95 deletions fmttests/testdata/format/leaves-via-network

Large diffs are not rendered by default.

116 changes: 91 additions & 25 deletions fmttests/testdata/format/opaque
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,19 @@ Error types: (1) *errbase.opaqueLeaf
=====
== Message payload
×
×
--
(1) ×
| ×
|
| (opaque error leaf)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt
Error types: (1) *errbase.opaqueLeaf
-- report composition:
*fmttests.errNoFmt
== Extra "error types"
github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt (*::)
== Exception 1 (Module: "error domain: <none>")
Type: "*fmttests.errNoFmt"
Title: "×\n×"
Title: "×"
(NO STACKTRACE)

run
Expand Down Expand Up @@ -168,18 +173,27 @@ Error types: (1) *fmttests.werrFmt (2) *errbase.opaqueLeaf
===== Sentry reporting
=====
== Message payload
×
×: ×
(1) ××
×
×
×
--
×
Wraps: (2) ×
| ×
|
| (opaque error leaf)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt
Error types: (1) *fmttests.werrFmt (2) *errbase.opaqueLeaf
-- report composition:
*fmttests.errNoFmt
*fmttests.werrFmt
== Extra "error types"
github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt (*::)
github.com/cockroachdb/errors/fmttests/*fmttests.werrFmt (*::)
== Exception 1 (Module: "error domain: <none>")
Type: "*fmttests.errNoFmt"
Title: "×\n×: ×\n×"
Title: "×: ×"
(NO STACKTRACE)

run
Expand Down Expand Up @@ -283,18 +297,27 @@ Error types: (1) *errbase.opaqueWrapper (2) *errbase.opaqueLeaf
===== Sentry reporting
=====
== Message payload
×
×: ×
×
--
(1) ×
| ×
|
| (opaque error wrapper)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt
Wraps: (2) ×
| ×
|
| (opaque error leaf)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt
Error types: (1) *errbase.opaqueWrapper (2) *errbase.opaqueLeaf
-- report composition:
*fmttests.errNoFmt
*fmttests.werrNoFmt
== Extra "error types"
github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt (*::)
github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt (*::)
== Exception 1 (Module: "error domain: <none>")
Type: "*fmttests.errNoFmt"
Title: "×\n×: ×\n×"
Title: "×: ×"
(NO STACKTRACE)

run
Expand Down Expand Up @@ -417,11 +440,24 @@ Error types: (1) *fmttests.werrFmt (2) *errbase.opaqueWrapper (3) *errbase.opaqu
===== Sentry reporting
=====
== Message payload
×: ×: ×
(1) ××
×
×: ×
×: ×
×
--
×
×
Wraps: (2) ×
| ×
|
| (opaque error wrapper)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt
Wraps: (3) ×
| ×
|
| (opaque error leaf)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt
Error types: (1) *fmttests.werrFmt (2) *errbase.opaqueWrapper (3) *errbase.opaqueLeaf
-- report composition:
*fmttests.errNoFmt
*fmttests.werrNoFmt
*fmttests.werrFmt
Expand All @@ -431,7 +467,7 @@ github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt (*::)
github.com/cockroachdb/errors/fmttests/*fmttests.werrFmt (*::)
== Exception 1 (Module: "error domain: <none>")
Type: "*fmttests.errNoFmt"
Title: "×\n×: ×\n×: ×\n×"
Title: "×: ×: ×"
(NO STACKTRACE)

run
Expand Down Expand Up @@ -566,11 +602,24 @@ Error types: (1) *errbase.opaqueWrapper (2) *errbase.opaqueWrapper (3) *errbase.
===== Sentry reporting
=====
== Message payload
×
×: ×
×: ×
×
--
×: ×: ×
(1) ×
| ×
|
| (opaque error wrapper)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt
Wraps: (2) ×
| ×
|
| (opaque error wrapper)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt
Wraps: (3) ×
| ×
|
| (opaque error leaf)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt
Error types: (1) *errbase.opaqueWrapper (2) *errbase.opaqueWrapper (3) *errbase.opaqueLeaf
-- report composition:
*fmttests.errNoFmt
*fmttests.werrNoFmt
*fmttests.werrNoFmt
Expand All @@ -580,7 +629,7 @@ github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt (*::)
github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt (*::)
== Exception 1 (Module: "error domain: <none>")
Type: "*fmttests.errNoFmt"
Title: "×\n×: ×\n×: ×\n×"
Title: "×: ×: ×"
(NO STACKTRACE)

run
Expand Down Expand Up @@ -734,12 +783,29 @@ Error types: (1) *fmttests.werrFmt (2) *errbase.opaqueWrapper (3) *errbase.opaqu
===== Sentry reporting
=====
== Message payload
×: ×: ×: ×
(1) ××
×
×
×: ×
×: ×
×: ×
×
--
×
Wraps: (2) ×
| ×
|
| (opaque error wrapper)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt
Wraps: (3) ×
| ×
|
| (opaque error wrapper)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt
Wraps: (4) ×
| ×
|
| (opaque error leaf)
| type name: github.com/cockroachdb/errors/fmttests/*fmttests.errNoFmt
Error types: (1) *fmttests.werrFmt (2) *errbase.opaqueWrapper (3) *errbase.opaqueWrapper (4) *errbase.opaqueLeaf
-- report composition:
*fmttests.errNoFmt
*fmttests.werrNoFmt
*fmttests.werrNoFmt
Expand All @@ -751,5 +817,5 @@ github.com/cockroachdb/errors/fmttests/*fmttests.werrNoFmt (*::)
github.com/cockroachdb/errors/fmttests/*fmttests.werrFmt (*::)
== Exception 1 (Module: "error domain: <none>")
Type: "*fmttests.errNoFmt"
Title: "×\n×: ×\n×: ×\n×: ×\n×"
Title: "×: ×: ×: ×"
(NO STACKTRACE)
Loading

0 comments on commit cc2568c

Please sign in to comment.