]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
Add labels to sysctls related to clocks.
authored <ed@FreeBSD.org>
Wed, 14 Dec 2016 12:56:58 +0000 (12:56 +0000)
committered <ed@FreeBSD.org>
Wed, 14 Dec 2016 12:56:58 +0000 (12:56 +0000)
Sysctls like kern.eventtimer.et.*.quality currently embed the name of
the clock device. This is problematic for the Prometheus metrics
exporter for two reasons:

- Some of those clocks have dashes in their names, which Prometheus
  doesn't allow to be used in metric names.
- It doesn't allow for extracting the same property of all clocks on the
  system from within a single query.

Attach these nodes to have a label, so that the Prometheus metrics
exporter gives these metric a uniform name with the name of the clock
attached as a label.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D8775

sys/kern/kern_et.c
sys/kern/kern_tc.c

index 979e0c5cf24aa2dd5af785915588259da08e1bc6..3d25d697ccc51a056203fd50a1197d357e1bf257 100644 (file)
@@ -66,9 +66,9 @@ et_register(struct eventtimer *et)
                }
        }
        KASSERT(et->et_start, ("et_register: timer has no start function"));
-       et->et_sysctl = SYSCTL_ADD_NODE(NULL,
+       et->et_sysctl = SYSCTL_ADD_NODE_WITH_LABEL(NULL,
            SYSCTL_STATIC_CHILDREN(_kern_eventtimer_et), OID_AUTO, et->et_name,
-           CTLFLAG_RW, 0, "event timer description");
+           CTLFLAG_RW, 0, "event timer description", "eventtimer");
        SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(et->et_sysctl), OID_AUTO,
            "flags", CTLFLAG_RD, &(et->et_flags), 0,
            "Event timer capabilities");
index b69bff526f9bec80af7f4e6eb72b14901d25752b..e81e33f5f276eeb7a69f8fb11ee244cde8a9118d 100644 (file)
@@ -1218,9 +1218,9 @@ tc_init(struct timecounter *tc)
        /*
         * Set up sysctl tree for this counter.
         */
-       tc_root = SYSCTL_ADD_NODE(NULL,
+       tc_root = SYSCTL_ADD_NODE_WITH_LABEL(NULL,
            SYSCTL_STATIC_CHILDREN(_kern_timecounter_tc), OID_AUTO, tc->tc_name,
-           CTLFLAG_RW, 0, "timecounter description");
+           CTLFLAG_RW, 0, "timecounter description", "timecounter");
        SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(tc_root), OID_AUTO,
            "mask", CTLFLAG_RD, &(tc->tc_counter_mask), 0,
            "mask for implemented bits");