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

Update backup log to reflect appropriate backup phase #7076

Merged

Conversation

shubham-pampattiwar
Copy link
Collaborator

Thank you for contributing to Velero!

Please add a summary of your change

The current Backup Completed log may not be appropriate for cases when there are some associated asynchronous plugin actions still being processed, so this PR updates the log to reflect the appropriate backup phase as per the ongoing backup process phase.

Please indicate you've done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

@shubham-pampattiwar shubham-pampattiwar added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Nov 8, 2023
@@ -792,7 +792,7 @@ func (b *backupReconciler) runBackup(backup *pkgbackup.Request) error {
}
}

b.logger.WithField(Backup, kubeutil.NamespaceAndName(backup)).Info("Backup completed")
b.logger.WithField(Backup, kubeutil.NamespaceAndName(backup)).Info(fmt.Sprintf("Initial backup processing complete, moving to %s", backup.Status.Phase))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
b.logger.WithField(Backup, kubeutil.NamespaceAndName(backup)).Info(fmt.Sprintf("Initial backup processing complete, moving to %s", backup.Status.Phase))
b.logger.WithField(Backup, kubeutil.NamespaceAndName(backup)).Info(fmt.Sprintf("Initial backup processing completed, moving to %s", backup.Status.Phase))

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think "complete" is better. i.e. "processing is complete" -- it avoids confusion with the "Completed" phase.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

+1 for complete

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #7076 (ea7f249) into main (5f7e16b) will increase coverage by 0.11%.
Report is 8 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #7076      +/-   ##
==========================================
+ Coverage   61.02%   61.13%   +0.11%     
==========================================
  Files         255      256       +1     
  Lines       27040    27143     +103     
==========================================
+ Hits        16500    16594      +94     
- Misses       9361     9368       +7     
- Partials     1179     1181       +2     
Files Coverage Δ
pkg/controller/backup_controller.go 61.05% <100.00%> (ø)

... and 2 files with indirect coverage changes

@@ -792,7 +792,7 @@ func (b *backupReconciler) runBackup(backup *pkgbackup.Request) error {
}
}

b.logger.WithField(Backup, kubeutil.NamespaceAndName(backup)).Info("Backup completed")
b.logger.WithField(Backup, kubeutil.NamespaceAndName(backup)).Info(fmt.Sprintf("Initial backup processing complete, moving to %s", backup.Status.Phase))
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of fmt.Sprintf, can you use InfoF? (maybe aldo need to add line break \n)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Infof is better than Sprintf into Info, although I don't think we generally include line breaks in log messages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just worried that somethings add line break at the end (like fmt.Println), but others don't (like fmt.Printf), to do not have disorganized logs

Copy link
Collaborator

Choose a reason for hiding this comment

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

@mateusoliveira43 I'm not seeing any other log messages w/ \n in the codebase

Copy link
Member

Choose a reason for hiding this comment

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

each log call should be single line. New line will always have timestamp in front.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation, no line break needed 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, Updated the PR @mateusoliveira43 @sseago @kaovilai

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

use infof instead of sprintf

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
@shubham-pampattiwar shubham-pampattiwar merged commit 2bd9bf2 into vmware-tanzu:main Dec 11, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants