From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH 1/2] debuginfod: Add found_{executable,debuginfo,sourcerefs}_total metrics.
Date: Sun, 24 Nov 2019 19:58:00 -0000 [thread overview]
Message-ID: <20191124195815.5786-2-mark@klomp.org> (raw)
In-Reply-To: <20191124195815.5786-1-mark@klomp.org>
Keeps metrics of how many executables, debuginfo and sourcerefs were
found in total for file and rpm scanners.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
debuginfod/ChangeLog | 8 ++++++++
debuginfod/debuginfod.cxx | 24 ++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 47efb9b4..bd3db9ff 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,11 @@
+2019-11-24 Mark Wielaard <mark@klomp.org>
+
+ * debuginfod.cxx (add_metric): New function.
+ (scan_source_file_path): Record metrics for
+ found_executable_total, found_debuginfo_total and
+ found_sourcerefs_total.
+ (scan_source_rpm_path): Likewise.
+
2019-11-07 Frank Ch. Eigler <fche@redhat.com>
* debuginfod.cxx: Add /metrics endpoint. Add numerous
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index f4bbc7b7..3717aa82 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -385,6 +385,9 @@ static void set_metric(const string& metric,
int64_t value);
static void inc_metric(const string& metric,
const string& lname, const string& lvalue);
+static void add_metric(const string& metric,
+ const string& lname, const string& lvalue,
+ int64_t value);
/* Handle program arguments. */
static error_t
@@ -1146,6 +1149,15 @@ inc_metric(const string& metric,
unique_lock<mutex> lock(metrics_lock);
metrics[key] ++;
}
+static void
+add_metric(const string& metric,
+ const string& lname, const string& lvalue,
+ int64_t value)
+{
+ string key = (metric + "{" + metric_label(lname, lvalue) + "}");
+ unique_lock<mutex> lock(metrics_lock);
+ metrics[key] += value;
+}
// and more for higher arity labels if needed
@@ -1706,6 +1718,10 @@ scan_source_file_path (const string& dir)
.bind(5, f->fts_statp->st_mtime)
.step_ok_done();
}
+ if (executable_p)
+ inc_metric("found_executable_total","source","files");
+ if (debuginfo_p)
+ inc_metric("found_debuginfo_total","source","files");
if (sourcefiles.size() && buildid != "")
{
@@ -1748,6 +1764,8 @@ scan_source_file_path (const string& dir)
.bind(3, srps)
.bind(4, sfs.st_mtime)
.step_ok_done();
+
+ inc_metric("found_sourcerefs_total","source","files");
}
}
@@ -2145,6 +2163,12 @@ scan_source_rpm_path (const string& dir)
my_fts_executable, my_fts_debuginfo, my_fts_sref, my_fts_sdef,
my_fts_sref_complete_p);
inc_metric ("scanned_total","source","rpm");
+ add_metric("found_debuginfo_total","source","rpm",
+ my_fts_debuginfo);
+ add_metric("found_executable_total","source","rpm",
+ my_fts_executable);
+ add_metric("found_sourcerefs_total","source","rpm",
+ my_fts_sref);
}
catch (const reportable_exception& e)
{
--
2.18.1
next prev parent reply other threads:[~2019-11-24 19:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-24 19:58 Add some metrics to debuginfod and use them to make test sleep less Mark Wielaard
2019-11-24 19:58 ` Mark Wielaard [this message]
2019-11-24 19:58 ` [PATCH 2/2] tests: Don't sleep in run-debuginfod-find.sh, but wait till ready Mark Wielaard
2019-11-25 20:53 ` Add some metrics to debuginfod and use them to make test sleep less Mark Wielaard
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=20191124195815.5786-2-mark@klomp.org \
--to=mark@klomp.org \
--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).