backup: refactor backup telemetry to use besteffort#159061
Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom Jan 22, 2026
Merged
backup: refactor backup telemetry to use besteffort#159061craig[bot] merged 2 commits intocockroachdb:masterfrom
craig[bot] merged 2 commits intocockroachdb:masterfrom
Conversation
Member
Contributor
Author
|
this is stacked on #159057 |
2e572f7 to
b650bca
Compare
|
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
2314aa7 to
c21899f
Compare
jeffswenson
approved these changes
Jan 21, 2026
pkg/backup/backup_telemetry.go
Outdated
| log.StructuredEvent(ctx, severity.INFO, &event) | ||
| besteffort.Warning(ctx, "log-backup-telemetry", func(ctx context.Context) error { | ||
| event, err := createBackupRecoveryEvent(ctx, initialDetails, jobID) | ||
| if err == nil { |
Collaborator
There was a problem hiding this comment.
nit: the err == nil check is correct, but I think its best to stick to the if err != nil { return err} pattern if possible even if its one more lines of code. It's way more common, which makes the code a little easier to read.
event, err := createBackupRecoveryEvent(...)
if err != nil {
return err
}
log.StructuredEvent(...)
return nil
}c21899f to
b3d7fde
Compare
This adds a package that can be used to mark blocks of code as best effort. This is intended to replace most instances of error logging in the dr codebase. Fixes: cockroachdb#152677
Previously backup telemetry used explicit logging and now uses the besteffort package. The backups hooks goroutine handling was cleaned up as part of besteffort refactoring. Release note: None Part of: cockroachdb#152677
b3d7fde to
aa27876
Compare
Contributor
Author
|
bors r+ |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously backup telemetry used explicit logging and now uses the besteffort
package. The backups hooks goroutine handling was cleaned up as part of
besteffort refactoring.
Release note: None
Part of: #152677