Add label annotations to CAM sysctls.
Under kern.cam we have certain sysctls that are per-device, such as the ones under kern.cam.ada.[0-9]+.*. Add a "device_index" label annotation to such sysctls, so that the Prometheus metrics exporter will give all of those metrics the same name. The device number will be added to the metric name as the "device_index" label. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D8775
This commit is contained in:
parent
2e5ad04e96
commit
ba13e5862b
@ -1394,9 +1394,9 @@ adasysctlinit(void *context, int pending)
|
||||
|
||||
sysctl_ctx_init(&softc->sysctl_ctx);
|
||||
softc->flags |= ADA_FLAG_SCTX_INIT;
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_kern_cam_ada), OID_AUTO, tmpstr2,
|
||||
CTLFLAG_RD, 0, tmpstr);
|
||||
CTLFLAG_RD, 0, tmpstr, "device_index");
|
||||
if (softc->sysctl_tree == NULL) {
|
||||
printf("adasysctlinit: unable to allocate sysctl tree\n");
|
||||
cam_periph_release(periph);
|
||||
|
@ -350,9 +350,9 @@ pmpsysctlinit(void *context, int pending)
|
||||
|
||||
sysctl_ctx_init(&softc->sysctl_ctx);
|
||||
softc->flags |= PMP_FLAG_SCTX_INIT;
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_kern_cam_pmp), OID_AUTO, tmpstr2,
|
||||
CTLFLAG_RD, 0, tmpstr);
|
||||
CTLFLAG_RD, 0, tmpstr, "device_index");
|
||||
if (softc->sysctl_tree == NULL) {
|
||||
printf("pmpsysctlinit: unable to allocate sysctl tree\n");
|
||||
cam_periph_release(periph);
|
||||
|
@ -608,9 +608,9 @@ ndasysctlinit(void *context, int pending)
|
||||
|
||||
sysctl_ctx_init(&softc->sysctl_ctx);
|
||||
softc->flags |= NDA_FLAG_SCTX_INIT;
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_kern_cam_nda), OID_AUTO, tmpstr2,
|
||||
CTLFLAG_RD, 0, tmpstr);
|
||||
CTLFLAG_RD, 0, tmpstr, "device_index");
|
||||
if (softc->sysctl_tree == NULL) {
|
||||
printf("ndasysctlinit: unable to allocate sysctl tree\n");
|
||||
cam_periph_release(periph);
|
||||
|
@ -481,9 +481,9 @@ cdsysctlinit(void *context, int pending)
|
||||
|
||||
sysctl_ctx_init(&softc->sysctl_ctx);
|
||||
softc->flags |= CD_FLAG_SCTX_INIT;
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_kern_cam_cd), OID_AUTO,
|
||||
tmpstr2, CTLFLAG_RD, 0, tmpstr);
|
||||
tmpstr2, CTLFLAG_RD, 0, tmpstr, "device_index");
|
||||
|
||||
if (softc->sysctl_tree == NULL) {
|
||||
printf("cdsysctlinit: unable to allocate sysctl tree\n");
|
||||
|
@ -1924,9 +1924,9 @@ dasysctlinit(void *context, int pending)
|
||||
|
||||
sysctl_ctx_init(&softc->sysctl_ctx);
|
||||
softc->flags |= DA_FLAG_SCTX_INIT;
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_kern_cam_da), OID_AUTO, tmpstr2,
|
||||
CTLFLAG_RD, 0, tmpstr);
|
||||
CTLFLAG_RD, 0, tmpstr, "device_index");
|
||||
if (softc->sysctl_tree == NULL) {
|
||||
printf("dasysctlinit: unable to allocate sysctl tree\n");
|
||||
cam_periph_release(periph);
|
||||
|
@ -2308,9 +2308,9 @@ sasysctlinit(void *context, int pending)
|
||||
|
||||
sysctl_ctx_init(&softc->sysctl_ctx);
|
||||
softc->flags |= SA_FLAG_SCTX_INIT;
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
|
||||
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_kern_cam_sa), OID_AUTO, tmpstr2,
|
||||
CTLFLAG_RD, 0, tmpstr);
|
||||
CTLFLAG_RD, 0, tmpstr, "device_index");
|
||||
if (softc->sysctl_tree == NULL)
|
||||
goto bailout;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user