-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util/mon: add monitor address to logging messages #79682
Conversation
I tried to find a way to print the pointer address in the redact API and didn't find anything better than I also noticed the stack traces weren't printed. Now the output looks like
when redaction is enabled. Without the fix to the stack traces it is:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I did not see this before!
The change looks good, but you still need a unit test.
I'm assuming that pointer addresses should be safe to not redact, right?
It's not for the redact
library to decide -- whether e.g. a pointer is nil or not can be sensitive information.
We could arguably decide that pointers are always safe in cockroachdb (via a new API in redact
to declare pointers as safe). If you find this important, please file an issue on the redact repo.
Reviewed 1 of 2 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @knz and @yuzefovich)
pkg/util/mon/bytes_usage.go
line 310 at r1 (raw file):
settings: settings, } m.nameWithPointer = redact.Sprintf("%s (%p)", name, redact.Safe(m))
Have you tried without redact.Safe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @knz and @yuzefovich)
pkg/util/mon/bytes_usage.go
line 310 at r1 (raw file):
Previously, knz (kena) wrote…
Have you tried without
redact.Safe
?
Oh sorry, this comment was before I read yours. Please ignore. Your code is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries! Your review is actually quite timely since we have another investigation that might benefit from this (from the monitor address part).
What unit test do you have in mind?
I'm assuming that pointer addresses should be safe to not redact, right?
It's not for the redact library to decide...
I meant the question only in general, i.e. "the pointer address is not PII, so it is safe to not redact, right?", I don't think it's needed to push this into redact
library.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @knz and @yuzefovich)
This will allow us to uniquely identify all messages coming from a single monitor. Additionally, this commit fixes the redactability of the file name and function name when getting a stack trace. Release note: None
Check that the pointer is included in the error messages. |
Note that the pointer is only included into the logging messages and not included into the error messages. I imagine to use this only as a debugging tool when tracking down memory accounting leaks, and in that use case we do enable verbose logging for In terms of the test - I feel like it's not worth it to do the effort of setting something up - this would require analysis of the trace and would probably be quite heavy-weight. Since this is an internal use case, manual one time QA I did already to make sure that the pointer does show up in the logs seems sufficient to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, 2 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)
@knz do I have your blessing? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)
TFTRs! bors r+ |
Build failed (retrying...): |
79682: util/mon: add monitor address to logging messages r=yuzefovich a=yuzefovich This will allow us to uniquely identify all messages coming from a single monitor. Additionally, this commit fixes the redactability of the file name and function name when getting a stack trace. Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
Build failed: |
bors r+ |
Build succeeded: |
blathers backport 22.1 |
blathers backport 21.2 |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from 1fd84d7 to blathers/backport-release-21.2-79682: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 21.2 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
This will allow us to uniquely identify all messages coming from
a single monitor. Additionally, this commit fixes the redactability of
the file name and function name when getting a stack trace.
Release note: None