@@ -240,6 +240,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
240240 if supportsHostnameLabel () {
241241 labels ["hostname" ] = mqmetric .DUMMY_STRING
242242 }
243+ if showAndSupportsCustomLabel () {
244+ labels ["custom" ] = mqmetric .GetObjectCustom ("" , ibmmq .MQOT_Q_MGR )
245+ }
243246 addMetaLabels (labels )
244247 m .addMetric (labels , 0.0 )
245248 m .Collect (ch )
@@ -501,6 +504,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
501504 if supportsHostnameLabel () {
502505 labels ["hostname" ] = mqmetric .GetQueueManagerAttribute (config .cf .QMgrName , ibmmq .MQCACF_HOST_NAME )
503506 }
507+ if showAndSupportsCustomLabel () {
508+ labels ["custom" ] = mqmetric .GetObjectCustom ("" , ibmmq .MQOT_Q_MGR )
509+ }
504510 addMetaLabels (labels )
505511 m .addMetric (labels , f )
506512 } else if strings .HasPrefix (key , mqmetric .NativeHAKeyPrefix ) {
@@ -530,6 +536,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
530536 "description" : mqmetric .GetObjectDescription (key , ibmmq .MQOT_Q ),
531537 "cluster" : mqmetric .GetQueueAttribute (key , ibmmq .MQCA_CLUSTER_NAME ),
532538 "platform" : platformString }
539+ if showAndSupportsCustomLabel () {
540+ labels ["custom" ] = mqmetric .GetObjectCustom (key , ibmmq .MQOT_Q )
541+ }
533542 addMetaLabels (labels )
534543 m .addMetric (labels , f )
535544 }
@@ -633,6 +642,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
633642 "description" : mqmetric .GetObjectDescription (qName , ibmmq .MQOT_Q ),
634643 "cluster" : mqmetric .GetQueueAttribute (qName , ibmmq .MQCA_CLUSTER_NAME ),
635644 "queue" : qName }
645+ if showAndSupportsCustomLabel () {
646+ labels ["custom" ] = mqmetric .GetObjectCustom (qName , ibmmq .MQOT_Q )
647+ }
636648 addMetaLabels (labels )
637649 m .addMetric (labels , f )
638650 }
@@ -696,6 +708,9 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
696708 if supportsHostnameLabel () {
697709 labels ["hostname" ] = mqmetric .GetQueueManagerAttribute (config .cf .QMgrName , ibmmq .MQCACF_HOST_NAME )
698710 }
711+ if showAndSupportsCustomLabel () {
712+ labels ["custom" ] = mqmetric .GetObjectCustom ("" , ibmmq .MQOT_Q_MGR )
713+ }
699714 addMetaLabels (labels )
700715 m .addMetric (labels , f )
701716 }
@@ -1061,6 +1076,9 @@ when the metrics are collected by Prometheus.
10611076*/
10621077func newMqVec (elem * mqmetric.MonElement ) * MQVec {
10631078 queueLabelNames := []string {"queue" , "qmgr" , "platform" , "usage" , "description" , "cluster" }
1079+ if showAndSupportsCustomLabel () {
1080+ queueLabelNames = append (queueLabelNames , "custom" )
1081+ }
10641082 nhaLabelNames := []string {"qmgr" , "platform" , "nha" }
10651083 // If the qmgr tags change, then check the special metric indicating qmgr unavailable as that's
10661084 // not part of the regular collection blocks.
@@ -1069,6 +1087,9 @@ func newMqVec(elem *mqmetric.MonElement) *MQVec {
10691087 if supportsHostnameLabel () {
10701088 qmgrLabelNames = append (qmgrLabelNames , "hostname" )
10711089 }
1090+ if showAndSupportsCustomLabel () {
1091+ qmgrLabelNames = append (qmgrLabelNames , "custom" )
1092+ }
10721093 labels := qmgrLabelNames
10731094 prefix := "qmgr_"
10741095
@@ -1171,6 +1192,9 @@ func newMqVecObj(attr *mqmetric.StatusAttribute, objectType string) *MQVec {
11711192 if supportsHostnameLabel () {
11721193 qmgrLabels = append (qmgrLabels , "hostname" )
11731194 }
1195+ if showAndSupportsCustomLabel () {
1196+ qmgrLabels = append (qmgrLabels , "custom" )
1197+ }
11741198 // With topic status, need to know if type is "pub" or "sub"
11751199 topicLabels := []string {"qmgr" , "platform" , objectType , "type" }
11761200 subLabels := []string {"qmgr" , "platform" , objectType , "subid" , "topic" , "type" }
@@ -1187,6 +1211,9 @@ func newMqVecObj(attr *mqmetric.StatusAttribute, objectType string) *MQVec {
11871211 // additional attributes. They should have the same labels as the stats generated
11881212 // through resource publications.
11891213 queueLabels := []string {"qmgr" , "platform" , objectType , "usage" , "description" , "cluster" }
1214+ if showAndSupportsCustomLabel () {
1215+ queueLabels = append (queueLabels , "custom" )
1216+ }
11901217
11911218 switch objectType {
11921219 case "channel" :
@@ -1274,6 +1301,10 @@ func supportsHostnameLabel() bool {
12741301 return rc
12751302}
12761303
1304+ func showAndSupportsCustomLabel () bool {
1305+ return config .cf .CC .ShowCustomAttribute
1306+ }
1307+
12771308func addMetaLabels (labels prometheus.Labels ) {
12781309 if len (config .cf .MetadataTagsArray ) > 0 {
12791310 for i := 0 ; i < len (config .cf .MetadataTagsArray ); i ++ {
0 commit comments