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

Add more logs to tail and service status monitor #518

Closed
wants to merge 5 commits into from

Conversation

edwardrf
Copy link
Contributor

@edwardrf edwardrf commented Jul 1, 2024

And also slight restructure of the service monitor and tail code to improve readability.

Slight restructure of the service monitor and tail code to improve
readbablity
@edwardrf edwardrf requested a review from lionello July 1, 2024 05:55
@edwardrf edwardrf changed the title Edw add tail log Add more logs to tail and service status monitor Jul 1, 2024
src/cmd/cli/command/commands.go Outdated Show resolved Hide resolved
@edwardrf edwardrf requested a review from lionello July 2, 2024 17:54
@edwardrf edwardrf marked this pull request as draft July 4, 2024 20:48
@edwardrf edwardrf marked this pull request as ready for review July 4, 2024 21:24
printEndpoints(serviceInfos)

if err != nil {
return err
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes the detach message regression

Comment on lines +835 to +836
if !errors.As(err, &cerr) {
term.Warnf("failed to start tailing, you will not be able to see logs: %v", err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am on the fence if this warning is needed

Comment on lines +24 to +27
if !errors.Is(err, context.Canceled) && !errors.Is(err, cli.ErrDryRun) && !errors.As(err, new(cliClient.ErrNotImplemented)) {
term.Info("Service status monitoring failed, we will continue tailing the logs. Press Ctrl+C to detach.")
}
term.Debugf("failed to wait for service status: %v", err)
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 code would be much simpler if we don't need to log these, but we risk swallow errors for debugging

@@ -825,30 +824,25 @@ var composeUpCmd = &cobra.Command{
return nil
}

tailCtx, cancelTail := context.WithCancel(ctx)
tailCtx, cancelTail := contextWithServiceStatus(ctx, cli.ServiceStarted, serviceInfos)
defer cancelTail()
Copy link
Member

Choose a reason for hiding this comment

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

how can this happen? startTailing blocks? You do <-Done() so this cancel is just for cleanup, in which case the name is wrong.

@lionello lionello mentioned this pull request Jul 19, 2024
1 task
@lionello lionello closed this Jul 25, 2024
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