debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used
authorMartin Liska <mliska@suse.cz>
Wed, 17 Aug 2022 07:38:17 +0000 (09:38 +0200)
committerMartin Liska <mliska@suse.cz>
Wed, 17 Aug 2022 12:50:10 +0000 (14:50 +0200)
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

index 366a4a0..3e2dd9e 100644 (file)
@@ -1921,7 +1921,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");
@@ -2083,7 +2084,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)