Skip to content
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/log: delay the formatting of log entries #58031

Merged
merged 1 commit into from
Dec 28, 2020

Conversation

knz
Copy link
Contributor

@knz knz commented Dec 17, 2020

Needed for #58126

Prior to this patch, the logging events were converted to a
logpb.Entry very early in the logging pipeline. This was forcing the
conversion of the logging tags to a flat string too early, and making
it hard for (e.g.) a JSON formatter to preserve the structure of
logging tags.

This patch averts this by introducing a new logEntry type which has
more-or-less the same structure as logpb.Entry but keep the logging
tags structured until the point the entry is formatted.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@knz knz changed the title [WIP] util/log: delay the formatting of log entries util/log: delay the formatting of log entries Dec 18, 2020
@knz knz requested a review from itsbilal December 18, 2020 16:49
@knz knz marked this pull request as ready for review December 18, 2020 16:49
@knz knz requested a review from a team as a code owner December 18, 2020 16:49
@knz knz force-pushed the 20201216-log-json branch 2 times, most recently from b3471b6 to 14d01f0 Compare December 18, 2020 18:40
@knz knz force-pushed the 20201216-log-json branch 3 times, most recently from d289642 to 41a572e Compare December 18, 2020 20:06
@knz
Copy link
Contributor Author

knz commented Dec 18, 2020

I am aware of a CI failure which is going to be fixed by a dep bump: cockroachdb/redact#14

@knz knz force-pushed the 20201216-log-json branch 3 times, most recently from e1ce16b to aff65d3 Compare December 21, 2020 15:10
Prior to this patch, the logging events were converted to a
`logpb.Entry` very early in the logging pipeline. This was forcing the
conversion of the logging tags to a flat string too early, and making
it hard for (e.g.) a JSON formatter to preserve the structure of
logging tags.

This patch averts this by introducing a new `logEntry` type which has
more-or-less the same structure as `logpb.Entry` but keep the logging
tags structured until the point the entry is formatted.

Release note: None
Copy link
Member

@itsbilal itsbilal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 21 of 21 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@knz
Copy link
Contributor Author

knz commented Dec 28, 2020

thanks!

bors r=itsbilal

@craig
Copy link
Contributor

craig bot commented Dec 28, 2020

Build succeeded:

@craig craig bot merged commit e2a49b5 into cockroachdb:master Dec 28, 2020
@knz knz deleted the 20201216-log-json branch December 28, 2020 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants