@@ -234,6 +234,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
234234 if supportsHostnameLabel () {
235235 labels ["hostname" ] = mqmetric .DUMMY_STRING
236236 }
237+ if showAndSupportsCustomLabel () {
238+ labels ["custom" ] = mqmetric .GetObjectCustom ("" , ibmmq .MQOT_Q_MGR )
239+ }
237240 addMetaLabels (labels )
238241 m .addMetric (labels , 0.0 )
239242 m .Collect (ch )
@@ -477,6 +480,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
477480 if supportsHostnameLabel () {
478481 labels ["hostname" ] = mqmetric .GetQueueManagerAttribute (config .cf .QMgrName , ibmmq .MQCACF_HOST_NAME )
479482 }
483+ if showAndSupportsCustomLabel () {
484+ labels ["custom" ] = mqmetric .GetObjectCustom ("" , ibmmq .MQOT_Q_MGR )
485+ }
480486 addMetaLabels (labels )
481487 m .addMetric (labels , f )
482488 } else if strings .HasPrefix (key , mqmetric .NativeHAKeyPrefix ) {
@@ -506,6 +512,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
506512 "description" : mqmetric .GetObjectDescription (key , ibmmq .MQOT_Q ),
507513 "cluster" : mqmetric .GetQueueAttribute (key , ibmmq .MQCA_CLUSTER_NAME ),
508514 "platform" : platformString }
515+ if showAndSupportsCustomLabel () {
516+ labels ["custom" ] = mqmetric .GetObjectCustom (key , ibmmq .MQOT_Q )
517+ }
509518 addMetaLabels (labels )
510519 m .addMetric (labels , f )
511520 }
@@ -603,6 +612,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
603612 "description" : mqmetric .GetObjectDescription (qName , ibmmq .MQOT_Q ),
604613 "cluster" : mqmetric .GetQueueAttribute (qName , ibmmq .MQCA_CLUSTER_NAME ),
605614 "queue" : qName }
615+ if showAndSupportsCustomLabel () {
616+ labels ["custom" ] = mqmetric .GetObjectCustom (qName , ibmmq .MQOT_Q )
617+ }
606618 addMetaLabels (labels )
607619 m .addMetric (labels , f )
608620 }
@@ -666,6 +678,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
666678 if supportsHostnameLabel () {
667679 labels ["hostname" ] = mqmetric .GetQueueManagerAttribute (config .cf .QMgrName , ibmmq .MQCACF_HOST_NAME )
668680 }
681+ if showAndSupportsCustomLabel () {
682+ labels ["custom" ] = mqmetric .GetObjectCustom ("" , ibmmq .MQOT_Q_MGR )
683+ }
669684 addMetaLabels (labels )
670685 m .addMetric (labels , f )
671686 }
@@ -992,6 +1007,9 @@ when the metrics are collected by Prometheus.
9921007*/
9931008func newMqVec (elem * mqmetric.MonElement ) * MQVec {
9941009 queueLabelNames := []string {"queue" , "qmgr" , "platform" , "usage" , "description" , "cluster" }
1010+ if showAndSupportsCustomLabel () {
1011+ queueLabelNames = append (queueLabelNames , "custom" )
1012+ }
9951013 nhaLabelNames := []string {"qmgr" , "platform" , "nha" }
9961014 // If the qmgr tags change, then check the special metric indicating qmgr unavailable as that's
9971015 // not part of the regular collection blocks.
@@ -1000,6 +1018,9 @@ func newMqVec(elem *mqmetric.MonElement) *MQVec {
10001018 if supportsHostnameLabel () {
10011019 qmgrLabelNames = append (qmgrLabelNames , "hostname" )
10021020 }
1021+ if showAndSupportsCustomLabel () {
1022+ qmgrLabelNames = append (qmgrLabelNames , "custom" )
1023+ }
10031024 labels := qmgrLabelNames
10041025 prefix := "qmgr_"
10051026
@@ -1101,6 +1122,9 @@ func newMqVecObj(attr *mqmetric.StatusAttribute, objectType string) *MQVec {
11011122 if supportsHostnameLabel () {
11021123 qmgrLabels = append (qmgrLabels , "hostname" )
11031124 }
1125+ if showAndSupportsCustomLabel () {
1126+ qmgrLabels = append (qmgrLabels , "custom" )
1127+ }
11041128 // With topic status, need to know if type is "pub" or "sub"
11051129 topicLabels := []string {"qmgr" , "platform" , objectType , "type" }
11061130 subLabels := []string {"qmgr" , "platform" , objectType , "subid" , "topic" , "type" }
@@ -1115,6 +1139,9 @@ func newMqVecObj(attr *mqmetric.StatusAttribute, objectType string) *MQVec {
11151139 // additional attributes. They should have the same labels as the stats generated
11161140 // through resource publications.
11171141 queueLabels := []string {"qmgr" , "platform" , objectType , "usage" , "description" , "cluster" }
1142+ if showAndSupportsCustomLabel () {
1143+ queueLabels = append (queueLabels , "custom" )
1144+ }
11181145
11191146 switch objectType {
11201147 case "channel" :
@@ -1200,6 +1227,10 @@ func supportsHostnameLabel() bool {
12001227 return rc
12011228}
12021229
1230+ func showAndSupportsCustomLabel () bool {
1231+ return config .cf .CC .ShowCustomAttribute
1232+ }
1233+
12031234func addMetaLabels (labels prometheus.Labels ) {
12041235 if len (config .cf .MetadataTagsArray ) > 0 {
12051236 for i := 0 ; i < len (config .cf .MetadataTagsArray ); i ++ {
0 commit comments