log: embed error hints in unstructured entries#82891
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Nov 1, 2022
Merged
log: embed error hints in unstructured entries#82891craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
With this commit, if a `log.Infof` (or warning, error, fatal etc) call is passed an `error` object as argument, and that error object contains hints, the hints are copied into the resulting log entry and emitted to the sink. At this time, we only have hints in very few places. This change is thus merely infrastructure that will promote the implementation of hints over time. Example, before: ``` W220614 15:55:33.935575 1 cli/start.go:184 [n?] 5 cannot create trace dir; traces will not be dumped: mkdir inflight_trace_dump: permission denied ``` Example, after: ``` W220614 15:57:58.669410 1 cli/start.go:185 [n?] 5 cannot create trace dir; traces will not be dumped: mkdir inflight_trace_dump: permission denied W220614 15:57:58.669410 1 cli/start.go:185 [n?] 5 +HINT: Try changing the CWD of the cockroach process to a writable directory. ``` Release note (cli change): In some cases, CockroachDB will now include recommended remediation actions alongside log messages. We expect more suggestions to be added in later versions.
Member
abarganier
approved these changes
Jun 28, 2022
Contributor
abarganier
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @abarganier and @knz)
pkg/util/log/log_entry.go line 265 at r1 (raw file):
h := errors.FlattenHints(e) if h != "" { buf.WriteString("\nHINT:")
nit: should this string contain a space after the colon to keep consistent with the redactable branch?
Suggestion:
"\nHINT:"
cameronnunez
approved these changes
Aug 15, 2022
Contributor
cameronnunez
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 2 of 0 LGTMs obtained (waiting on @abarganier and @knz)
Contributor
Author
|
bors r=abargainier,cameronnunez |
Contributor
|
Build succeeded: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #80875.
cc @dhartunian
With this commit, if a
log.Infof(or warning, error, fatal etc) callis passed an
errorobject as argument, and that error objectcontains hints, the hints are copied into the resulting log entry and
emitted to the sink.
At this time, we only have hints in very few places. This change is
thus merely infrastructure that will promote the implementation of
hints over time.
Example, before:
Example, after:
Release note (cli change): In some cases, CockroachDB will now include
recommended remediation actions alongside log messages. We expect more
suggestions to be added in later versions.