public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>,
	"Proxmox Backup Server development discussion"
	<pbs-devel@lists.proxmox.com>,
	"Gabriel Goller" <g.goller@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 0/4] improve push sync job log messages
Date: Fri, 22 Nov 2024 09:41:23 +0100	[thread overview]
Message-ID: <dba30bdd-19d4-4e35-83bb-2c11c282ca26@proxmox.com> (raw)
In-Reply-To: <1840736894.8111.1732217576163@webmail.proxmox.com>

On 11/21/24 20:32, Fabian Grünbichler wrote:
> 
>> Gabriel Goller <g.goller@proxmox.com> hat am 21.11.2024 18:04 CET geschrieben:
>>
>>   
>> On 21.11.2024 17:26, Christian Ebner wrote:
>>> On 11/21/24 17:06, Gabriel Goller wrote:
>>>> I think I'd be nice if we use `.context()` instead of `format_err` and
>>>> debug print ("{err:?}") instead of default ("{}") here. As these
>>>> messages are all errors they shouldn't appear too often in the log and
>>>> if an error happens, you get much more information.
>>>>
>>>> What do you think?
>>>
>>> Hmm, can check that out, but wouldn't that disrupt the single line
>>> character of the log entries, prefixed by the time stamp?
>>
>> We could use "{err:#}", which will print everything in one line?
>>
>> Although on the other hand, I'd understand if you want to have strict
>> control over what is displayed to the users, so no hard feelings on
>> this one.
> 
> big tasks/job like the sync ones are a bit special w.r.t. error handling because they "catch" errors often at intermediate levels, log them, record that an error occur, but then proceed with a sensible next unit of work. so it's not possible to just add a lot of context to an error like with simple(r) API calls, where many/most errors can be treated as fatal, maybe requiring a bit of cleanup before bailing completely.
> 
> I think a good compromise is to treat those units of work as a sort of error scope, and
> - add context where it is missing (e.g., low level file or network access, where just bubbling up errors might be meaningless)
> - and then when logging the error, think about formatting

The current series already tries to follow your lead here, following 
along the lines of you followup patches to the original series.
I will however double check where the suggested adding of an anyhow 
Error context makes sense and how to best log soft errors without 
disrupting the logs to much, increasing the verbosity for now as you 
suggested below.

> 
> e.g., for syncs we have groups as lowest unit of work - if something fails within a group, we abort that group, but proceed with the next one. but if we just log "syncing group X failed - permission denied" that doesn't help whatsoever. it might be better to have three lines of warnings if something goes wrong, if those three lines contain appropriate information like
> - request X / file access Y /.. failed with error Z (root cause)
> - while processing snapshot A in group B (important context, because the request or path of the root cause might not tell us this)
> - syncing group B failed (result of the error chain)
> 
> achieving that requires carefully analyzing all error sources/chains though. when in doubt, I'd rather have a bit too much context initially (that usually means too much is added at lower levels and we can optimize there) than too little, but within reason ;) we can't travel back in time and add needed information to debug issues to our or users' logs, a stray duplicate context can easily be filtered out though. of course that doesn't mean every error is allowed to grow 10 lines long by default, balance is still important even when doing a first pass/implementation of improved error messages!
> 
> and of course, the general rule applies - if we use errors with proper context, it should be done fairly consistently, so that the next level up can actually use it. it might be easier to use format_err or explicit additional `warn!` invocations to improve the situation immediately, and postpone adding proper contexts to do it for all of sync without time pressure.

Yes, aligning the sync job logs for push and pull would of course also 
be of interest here, but given that the pull job also logs information 
not controlled by the job directly, but also indirectly by e.g. logs of 
operations on the datastore, that will require some more refactoring and 
reorganization of the logic to get it right, without breaking other logging.



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

  reply	other threads:[~2024-11-22  8:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-21 15:43 Christian Ebner
2024-11-21 15:43 ` [pbs-devel] [PATCH proxmox-backup 1/4] server: push: fix needless borrow clippy warning Christian Ebner
2024-11-21 15:43 ` [pbs-devel] [PATCH proxmox-backup 2/4] server: push: consistently use remote over target for error messages Christian Ebner
2024-11-21 15:43 ` [pbs-devel] [PATCH proxmox-backup 3/4] server: push: add error context to all target api calls Christian Ebner
2024-11-22  9:01   ` Fabian Grünbichler
2024-11-22 10:11     ` Christian Ebner
2024-11-21 15:43 ` [pbs-devel] [PATCH proxmox-backup 4/4] server: push: various smaller improvements to error messages Christian Ebner
2024-11-21 16:06 ` [pbs-devel] [PATCH proxmox-backup 0/4] improve push sync job log messages Gabriel Goller
2024-11-21 16:26   ` Christian Ebner
2024-11-21 17:04     ` Gabriel Goller
2024-11-21 19:32       ` Fabian Grünbichler
2024-11-22  8:41         ` Christian Ebner [this message]
2024-11-22 12:28   ` Christian Ebner
2024-11-22  9:04 ` [pbs-devel] partially-applied: " Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dba30bdd-19d4-4e35-83bb-2c11c282ca26@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=f.gruenbichler@proxmox.com \
    --cc=g.goller@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal