+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
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
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
.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 != "")
{
.bind(3, srps)
.bind(4, sfs.st_mtime)
.step_ok_done();
+
+ inc_metric("found_sourcerefs_total","source","files");
}
}
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)
{