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

roachprod: keep reference to parent logger #106850

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

renatolabs
Copy link
Collaborator

This changes roachprod's Logger to keep a reference to the parent instance when a call to ChildLogger is made. This allows any logger instance to then reference the root logger in the chain via a new RootLogger function added in this commit.

This function is used in newRemoteSession: when determining the path to the SSH log file, we now generate a path relative to the root logger, instead of relative to the logger instance passed as parameter. This makes it so that, on roachtest failures, the ssh/ directory is created at the top of the artifacts directory regardless of whether the test itself is using a ChildLogger or not.

Ideally, the remoteSession would have access to the artifacts directory, since that's what it actually cares about. Making that plumbing, however, would involve a significant amount of infrastructure and test changes, so this commit takes the pragmatic approach of assuming that the root logger points to the root of the artifacts directory, an assumption that will likely hold for a long time.

Epic: none

Release note: None

@renatolabs renatolabs requested a review from a team as a code owner July 14, 2023 17:51
@renatolabs renatolabs requested review from srosenberg and smg260 and removed request for a team July 14, 2023 17:51
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@renatolabs renatolabs force-pushed the rc/remote-session-child-logger branch from 58782cf to 3dc848f Compare July 14, 2023 17:52
@renatolabs renatolabs added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Jul 14, 2023
@renatolabs renatolabs force-pushed the rc/remote-session-child-logger branch from 3dc848f to e30afc2 Compare July 14, 2023 20:05
@renatolabs renatolabs force-pushed the rc/remote-session-child-logger branch from e30afc2 to f1d03c3 Compare July 18, 2023 13:15
@renatolabs
Copy link
Collaborator Author

Rebased against latest master to get the fix for #105726, which flaked on this PR.

@renatolabs renatolabs force-pushed the rc/remote-session-child-logger branch from f1d03c3 to fe35a46 Compare July 18, 2023 14:31
@renatolabs
Copy link
Collaborator Author

Rebased again to get the skip for a different flake in Essential CI (#106865).

This changes roachprod's Logger to keep a reference to the parent
instance when a call to `ChildLogger` is made. This allows any logger
instance to then reference the root logger in the chain via a new
`RootLogger` function added in this commit.

This function is used in `newRemoteSession`: when determining the path
to the SSH log file, we now generate a path relative to the root
logger, instead of relative to the logger instance passed as
parameter. This makes it so that, on roachtest failures, the `ssh/`
directory is created at the top of the artifacts directory regardless
of whether the test itself is using a `ChildLogger` or not.

Ideally, the `remoteSession` would have access to the artifacts
directory, since that's what it actually cares about. Making that
plumbing, however, would involve a significant amount of
infrastructure and test changes, so this commit takes the pragmatic
approach of assuming that the root logger points to the root of the
artifacts directory, an assumption that will likely hold for a long
time.

Epic: none

Release note: None
@renatolabs renatolabs force-pushed the rc/remote-session-child-logger branch from fe35a46 to 092154e Compare July 18, 2023 18:02
@renatolabs
Copy link
Collaborator Author

Rebased again due to another flake in Essential CI.

@renatolabs
Copy link
Collaborator Author

Another flake! #107098

@renatolabs
Copy link
Collaborator Author

TFTR!

bors r=srosenberg

@craig craig bot merged commit 66f234a into cockroachdb:master Jul 18, 2023
2 checks passed
@craig
Copy link
Contributor

craig bot commented Jul 18, 2023

Build succeeded:

@renatolabs renatolabs deleted the rc/remote-session-child-logger branch July 20, 2023 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants