11package main
22
33/*
4- Copyright (c) IBM Corporation 2016, 2022
4+ Copyright (c) IBM Corporation 2016, 2025
55
66 Licensed under the Apache License, Version 2.0 (the "License");
77 you may not use this file except in compliance with the License.
@@ -245,6 +245,9 @@ func Collect() error {
245245 if hostname != mqmetric .DUMMY_STRING {
246246 pt .Tags ["hostname" ] = hostname
247247 }
248+ if showAndSupportsCustomLabel () {
249+ pt .Tags ["custom" ] = mqmetric .GetObjectCustom ("" , ibmmq .MQOT_Q_MGR )
250+ }
248251 } else if strings .HasPrefix (key , mqmetric .NativeHAKeyPrefix ) {
249252 pt .Tags ["nha" ] = strings .Replace (key , mqmetric .NativeHAKeyPrefix , "" , - 1 )
250253 pt .ObjectType = "nha"
@@ -256,7 +259,9 @@ func Collect() error {
256259 pt .ObjectType = "queue"
257260 pt .Tags ["description" ] = mqmetric .GetObjectDescription (key , ibmmq .MQOT_Q )
258261 pt .Tags ["cluster" ] = mqmetric .GetQueueAttribute (key , ibmmq .MQCA_CLUSTER_NAME )
259-
262+ if showAndSupportsCustomLabel () {
263+ pt .Tags ["custom" ] = mqmetric .GetObjectCustom (key , ibmmq .MQOT_Q )
264+ }
260265 }
261266 addMetaLabels (pt .Tags )
262267 }
@@ -345,6 +350,9 @@ func Collect() error {
345350 pt .Tags ["queue" ] = qName
346351 pt .Tags ["usage" ] = usageString
347352 pt .Tags ["description" ] = mqmetric .GetObjectDescription (qName , ibmmq .MQOT_Q )
353+ if showAndSupportsCustomLabel () {
354+ pt .Tags ["custom" ] = mqmetric .GetObjectCustom (qName , ibmmq .MQOT_Q )
355+ }
348356 pt .Tags ["cluster" ] = mqmetric .GetQueueAttribute (key , ibmmq .MQCA_CLUSTER_NAME )
349357 pt .Tags ["platform" ] = platformString
350358 addMetaLabels (pt .Tags )
@@ -400,6 +408,9 @@ func Collect() error {
400408 pt .Tags ["qmgr" ] = strings .TrimSpace (qMgrName )
401409 pt .Tags ["platform" ] = platformString
402410 pt .Tags ["description" ] = mqmetric .GetObjectDescription ("" , ibmmq .MQOT_Q_MGR )
411+ if showAndSupportsCustomLabel () {
412+ pt .Tags ["custom" ] = mqmetric .GetObjectCustom ("" , ibmmq .MQOT_Q_MGR )
413+ }
403414 hostname := mqmetric .GetQueueManagerAttribute (config .cf .QMgrName , ibmmq .MQCACF_HOST_NAME )
404415 if hostname != mqmetric .DUMMY_STRING {
405416 pt .Tags ["hostname" ] = hostname
@@ -695,3 +706,7 @@ func addMetaLabels(tags map[string]string) {
695706 }
696707 }
697708}
709+
710+ func showAndSupportsCustomLabel () bool {
711+ return config .cf .CC .ShowCustomAttribute
712+ }
0 commit comments