From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id EDD3D1FF183 for ; Wed, 10 Sep 2025 10:32:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F0EB11B419; Wed, 10 Sep 2025 10:32:10 +0200 (CEST) Message-ID: Date: Wed, 10 Sep 2025 10:31:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Wolfgang Bumiller References: <20250909082608.1018103-1-d.csapak@proxmox.com> <5e6jb7tq2pmmmfnyucinmkch2c2o55u34c73wxqpelcjjcbmmd@ed2z44jgrve7> Content-Language: en-US From: Dominik Csapak In-Reply-To: <5e6jb7tq2pmmmfnyucinmkch2c2o55u34c73wxqpelcjjcbmmd@ed2z44jgrve7> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757493102543 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.599 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_BADIPHTTP 2 Due to the Storm Bot Network, IPs in emails is bad KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_SHORT 0.001 Use of a URL Shortener for very short URL NORMAL_HTTP_TO_IP 0.001 URI host has a public dotted-decimal IPv4 address NUMERIC_HTTP_ADDR 1.242 Uses a numeric IP address in URL RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [resources.rs, 0.0.0.0] WEIRD_PORT 0.001 Uses non-standard port number for HTTP Subject: Re: [pdm-devel] [RFC PATCH datacenter-manager] server: api: resources: use root cause for errors for remote fetching X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Cc: pdm-devel@lists.proxmox.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" On 9/10/25 10:15 AM, Wolfgang Bumiller wrote: > On Tue, Sep 09, 2025 at 10:25:51AM +0200, Dominik Csapak wrote: >> when we can't reach a remote for any reason, we want to return the error >> as a string here over the API. Since most errors that can occur here are >> client/network related (wrong credentials, no route to host, timeout, >> etc.) converting this error directly to a string gives us >> errors like: >> >> `client error (Connect)` >> >> which is not really helpful most of the time. >> Instead if we use the `root_cause()`, we get the most underlying error >> >> e.g. >> >> `error connecting to https://0.0.0.0:8006/ - tcp connect error: No route to host (os error 113)` >> >> which is much more helpful. >> >> We could also think about printing the whole error chain, but in my test >> cases here this was not more helpful, e.g. i got two times the above >> `client error (Connect)` and once the root cause from above. > > Curious, because from a quick grep, `client error (*)` comes from hyper. > Otherwise I'd say it may have been one our own error types or > one-too-many same `.context()` calls. > > I'm still not sure this is a good idea though, as we may still lose some > useful contest. I wish anyhow had an easy method to just shave off a > single layer. > > What if we do this, but first throw in a: > > tracing::debug!("{error:?}"); > > just so we still have the option to see everything if we need to? just to clarify: you want me to use root_cause and additionally log the error into the debug tracing? (not returning the whole `chain()` here) > >> >> Signed-off-by: Dominik Csapak >> --- >> server/src/api/resources.rs | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs >> index 98c4dea..cca8bcb 100644 >> --- a/server/src/api/resources.rs >> +++ b/server/src/api/resources.rs >> @@ -245,7 +245,7 @@ pub(crate) async fn get_resources_impl( >> let handle = tokio::spawn(async move { >> let (mut resources, error) = match get_resources_for_remote(remote, max_age).await { >> Ok(resources) => (resources, None), >> - Err(error) => (Vec::new(), Some(error.to_string())), >> + Err(error) => (Vec::new(), Some(error.root_cause().to_string())), >> }; >> >> if remotes_only { >> -- >> 2.47.2 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel