* [PATCH] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used
@ 2022-08-17 7:41 Martin Liška
2022-08-17 11:48 ` Frank Ch. Eigler
0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2022-08-17 7:41 UTC (permalink / raw)
To: elfutils-devel
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 | 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<string>& 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used
2022-08-17 7:41 [PATCH] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used Martin Liška
@ 2022-08-17 11:48 ` Frank Ch. Eigler
2022-08-17 11:54 ` [PATCH v2] " Martin Liška
0 siblings, 1 reply; 3+ messages in thread
From: Frank Ch. Eigler @ 2022-08-17 11:48 UTC (permalink / raw)
To: Martin Liška; +Cc: elfutils-devel
Hi -
> 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.
Noble goal:
> @@ -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)
.... but no need for an extra parameter. When conn==0, we have
an internal request, so can use that as a flag.
- FChE
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used
2022-08-17 11:48 ` Frank Ch. Eigler
@ 2022-08-17 11:54 ` Martin Liška
0 siblings, 0 replies; 3+ messages in thread
From: Martin Liška @ 2022-08-17 11:54 UTC (permalink / raw)
To: elfutils-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-17 11:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 7:41 [PATCH] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used Martin Liška
2022-08-17 11:48 ` Frank Ch. Eigler
2022-08-17 11:54 ` [PATCH v2] " Martin Liška
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).