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

democluster: improve logging/tracing #72642

Merged
merged 3 commits into from
Nov 18, 2021
Merged

Conversation

knz
Copy link
Contributor

@knz knz commented Nov 11, 2021

All commits but the last 3 from #72644
(Reviewers: only review last 3 commits)

Informs #58938

@knz knz requested a review from stevendanna November 11, 2021 14:23
@knz knz requested a review from a team as a code owner November 11, 2021 14:23
@knz knz requested a review from a team November 11, 2021 14:23
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

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

LGTM, let me know if you want to me to re-review the second commit in the set of three if you do a major enough refactor.

@@ -228,10 +228,11 @@ func (c *transientCluster) Start(
// Step 1: create the first node.
{
phaseCtx := logtags.AddTag(ctx, "phase", 1)
c.infoLog(phaseCtx, "creating the first node")
ctx := phaseCtx // shadow the original ctx; folk prefer this name to "phaseCtx".
Copy link
Contributor

Choose a reason for hiding this comment

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

nit (for all): folk prefer this name to "phaseCtx" didn't make sense to me as to what class of error this was preventing until i read the commit message. maybe shadow the original ctx to prevent accidentally using the original ctx instead of the phaseCtx which can be a easy reach as a mistake or something?

alternatively, make all these steps individual functions passing in the phase context and having the function take in ctx and avoid the shadowing entirely. hopefully the refactor for that isn't too nasty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, the individual functions seems to be the better choice. I'll work on that next.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(the linter doesn't like the shadowing anyway)

@knz knz force-pushed the 20211111-demo-phases branch from 1a5e571 to eb766b0 Compare November 12, 2021 15:09
@knz
Copy link
Contributor Author

knz commented Nov 12, 2021

RFAL

knz added 3 commits November 18, 2021 14:23
We've seen folk make mistakes because they instinctly reach to the
name "ctx" in their text editor. Prevent those mistakes
by ensuring the phase context is also called "ctx".

Release note: None
@knz knz force-pushed the 20211111-demo-phases branch from eb766b0 to d3ce8d3 Compare November 18, 2021 13:26
@knz
Copy link
Contributor Author

knz commented Nov 18, 2021

TFYR!

bors r=otan

@craig
Copy link
Contributor

craig bot commented Nov 18, 2021

Build failed:

@knz
Copy link
Contributor Author

knz commented Nov 18, 2021

bors r=otan

@craig
Copy link
Contributor

craig bot commented Nov 18, 2021

Build succeeded:

@craig craig bot merged commit 4d82c5f into cockroachdb:master Nov 18, 2021
@knz knz deleted the 20211111-demo-phases branch November 18, 2021 17:15
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