From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id CA3E83858D32 for ; Wed, 17 Aug 2022 07:41:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA3E83858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id F0EB93405C; Wed, 17 Aug 2022 07:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1660722096; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HuJ1p3O7qmeQtFbOeBmowjoTVfnC91W5n5hpjyk0BZA=; b=ZB7qbfJ1qJLJWkrA+DthO4tFnLHrhDfm23+WvzwxrNxOIKJ9/WrFZc8Z0BtL4KMyzYGTnT 7mOC7q8HEvmEnxlrUs5/5rDd8g3n2srUmjRplNab7j0lecGDDZ8MxhF2acHJamOE8bMB9/ 1bLhe75FfF5kvtG3MUkdDEqxS58ni0c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1660722096; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HuJ1p3O7qmeQtFbOeBmowjoTVfnC91W5n5hpjyk0BZA=; b=pby+YEO/BBkAjt4yXlIQW2l+Vdqoqp0Y00jMLeXub5ReA3+kem+PbdCdwXyx9HNiUjRwww 751dceieV2yIMXBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DB43C13428; Wed, 17 Aug 2022 07:41:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aMiGNLCb/GI7QwAAMHmgww (envelope-from ); Wed, 17 Aug 2022 07:41:36 +0000 Message-ID: Date: Wed, 17 Aug 2022 09:41:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used To: elfutils-devel@sourceware.org Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2022 07:41:40 -0000 When dwarf_extract_source_paths is called, it can call handle_buildid when a rpm file used dwz. Ignore such internal request in http_requests_total statistics. Signed-off-by: Martin Liska --- debuginfod/debuginfod.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 9245be53..89767d97 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -1906,7 +1906,7 @@ handle_buildid (MHD_Connection* conn, const string& buildid /* unsafe */, string& artifacttype /* unsafe, cleanse on exception/return */, const string& suffix /* unsafe */, - int *result_fd) + int *result_fd, bool update_metrics = true) { // validate artifacttype string atype_code; @@ -1918,7 +1918,8 @@ handle_buildid (MHD_Connection* conn, throw reportable_exception("invalid artifacttype"); } - inc_metric("http_requests_total", "type", artifacttype); + if (update_metrics) + inc_metric("http_requests_total", "type", artifacttype); if (atype_code == "S" && suffix == "") throw reportable_exception("invalid source suffix"); @@ -2080,7 +2081,8 @@ and will not query the upstream servers"); if (fd >= 0) { - inc_metric ("http_responses_total","result","upstream"); + if (update_metrics) + inc_metric ("http_responses_total","result","upstream"); struct stat s; int rc = fstat (fd, &s); if (rc == 0) @@ -2488,7 +2490,7 @@ dwarf_extract_source_paths (Elf *elf, set& debug_sourcefiles) try { string artifacttype = "debuginfo"; - r = handle_buildid (0, buildid, artifacttype, "", &alt_fd); + r = handle_buildid (0, buildid, artifacttype, "", &alt_fd, false); } catch (const reportable_exception& e) { -- 2.37.1