Also gate SPL statistics behind 'experimental' command line option
authorjob <job@openbsd.org>
Tue, 3 Sep 2024 15:04:48 +0000 (15:04 +0000)
committerjob <job@openbsd.org>
Tue, 3 Sep 2024 15:04:48 +0000 (15:04 +0000)
This changes the JSON output, without -x some keys are missing from 'metadata'

OK tb@

usr.sbin/rpki-client/main.c
usr.sbin/rpki-client/output-json.c
usr.sbin/rpki-client/output-ometric.c

index 7ff8949..88b3045 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: main.c,v 1.264 2024/08/20 13:31:49 claudio Exp $ */
+/*     $OpenBSD: main.c,v 1.265 2024/09/03 15:04:48 job Exp $ */
 /*
  * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -1489,9 +1489,12 @@ main(int argc, char *argv[])
            "invalid)\n", stats.repo_tal_stats.aspas,
            stats.repo_tal_stats.aspas_fail,
            stats.repo_tal_stats.aspas_invalid);
-       printf("Signed Prefix Lists: %u (%u failed parse, %u invalid)\n",
-           stats.repo_tal_stats.spls, stats.repo_tal_stats.spls_fail,
-           stats.repo_tal_stats.spls_invalid);
+       if (experimental) {
+               printf("Signed Prefix Lists: %u "
+                   "(%u failed parse, %u invalid)\n",
+                   stats.repo_tal_stats.spls, stats.repo_tal_stats.spls_fail,
+                   stats.repo_tal_stats.spls_invalid);
+       }
        printf("BGPsec Router Certificates: %u\n", stats.repo_tal_stats.brks);
        printf("Certificates: %u (%u invalid)\n",
            stats.repo_tal_stats.certs, stats.repo_tal_stats.certs_fail);
index bc0695e..d69d95f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: output-json.c,v 1.49 2024/04/21 19:27:44 claudio Exp $ */
+/*     $OpenBSD: output-json.c,v 1.50 2024/09/03 15:04:48 job Exp $ */
 /*
  * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
  *
@@ -47,9 +47,11 @@ outputheader_json(struct stats *st)
        json_do_int("roas", st->repo_tal_stats.roas);
        json_do_int("failedroas", st->repo_tal_stats.roas_fail);
        json_do_int("invalidroas", st->repo_tal_stats.roas_invalid);
-       json_do_int("spls", st->repo_tal_stats.spls);
-       json_do_int("failedspls", st->repo_tal_stats.spls_fail);
-       json_do_int("invalidspls", st->repo_tal_stats.spls_invalid);
+       if (experimental) {
+               json_do_int("spls", st->repo_tal_stats.spls);
+               json_do_int("failedspls", st->repo_tal_stats.spls_fail);
+               json_do_int("invalidspls", st->repo_tal_stats.spls_invalid);
+       }
        json_do_int("aspas", st->repo_tal_stats.aspas);
        json_do_int("failedaspas", st->repo_tal_stats.aspas_fail);
        json_do_int("invalidaspas", st->repo_tal_stats.aspas_invalid);
index a2795f1..8eb6736 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: output-ometric.c,v 1.10 2024/04/08 14:02:13 tb Exp $ */
+/*     $OpenBSD: output-ometric.c,v 1.11 2024/09/03 15:04:48 job Exp $ */
 /*
  * Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
  *
@@ -85,12 +85,14 @@ set_common_stats(const struct repotalstats *in, struct ometric *metric,
        ometric_set_int_with_labels(metric, in->vaps_overflowed,
            OKV("type", "state"), OKV("vap overflowed"), ol);
 
-       ometric_set_int_with_labels(metric, in->spls,
-           OKV("type", "state"), OKV("spl", "valid"), ol);
-       ometric_set_int_with_labels(metric, in->spls_fail,
-           OKV("type", "state"), OKV("spl", "failed parse"), ol);
-       ometric_set_int_with_labels(metric, in->spls_invalid,
-           OKV("type", "state"), OKV("spl", "invalid"), ol);
+       if (experimental) {
+               ometric_set_int_with_labels(metric, in->spls,
+                   OKV("type", "state"), OKV("spl", "valid"), ol);
+               ometric_set_int_with_labels(metric, in->spls_fail,
+                   OKV("type", "state"), OKV("spl", "failed parse"), ol);
+               ometric_set_int_with_labels(metric, in->spls_invalid,
+                   OKV("type", "state"), OKV("spl", "invalid"), ol);
+       }
 
        ometric_set_int_with_labels(metric, in->vsps,
            OKV("type", "state"), OKV("vsp", "total"), ol);