public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: elfutils-devel@sourceware.org
Subject: [PATCH v2] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used
Date: Wed, 17 Aug 2022 13:54:51 +0200	[thread overview]
Message-ID: <59784623-d948-15a2-e404-40c21e41f728@suse.cz> (raw)
In-Reply-To: <20220817114801.GB4328@redhat.com>

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 <mliska@suse.cz>
---
 debuginfod/debuginfod.cxx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 9245be53..2bfc8af5 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1918,7 +1918,8 @@ handle_buildid (MHD_Connection* conn,
     throw reportable_exception("invalid artifacttype");
   }
 
-  inc_metric("http_requests_total", "type", artifacttype);
+  if (conn != 0)
+    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 (conn != 0)
+	inc_metric ("http_responses_total","result","upstream");
       struct stat s;
       int rc = fstat (fd, &s);
       if (rc == 0)
-- 
2.37.1


      reply	other threads:[~2022-08-17 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  7:41 [PATCH] " Martin Liška
2022-08-17 11:48 ` Frank Ch. Eigler
2022-08-17 11:54   ` Martin Liška [this message]

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=59784623-d948-15a2-e404-40c21e41f728@suse.cz \
    --to=mliska@suse.cz \
    --cc=elfutils-devel@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).