@@ -64,6 +64,8 @@ const (
6464 SQUASH_CHL_STATUS_STOPPED = 0
6565 SQUASH_CHL_STATUS_TRANSITION = 1
6666 SQUASH_CHL_STATUS_RUNNING = 2
67+
68+ DUMMY_STRING = "-" // To provide a non-empty value for certain fields
6769)
6870
6971var ChannelStatus StatusSet
@@ -317,9 +319,14 @@ func parseChlData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string {
317319 }
318320
319321 // Prometheus was ignoring a blank string which then got translated into "0.00" in Grafana
320- // So if there is no remote qmgr, force a non-empty string value in there
322+ // So if there is no remote qmgr, force a non-empty string value in there. Similarly, the jobname for
323+ // inactive channels often arrives looking like "00000" but not filling the entire length
324+ // allowed. So reset that one too.
321325 if rqmName == "" {
322- rqmName = "-"
326+ rqmName = DUMMY_STRING
327+ }
328+ if jobName == "" || allZero (jobName ) {
329+ jobName = DUMMY_STRING
323330 }
324331
325332 // Create a unique key for this channel instance
@@ -329,7 +336,7 @@ func parseChlData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string {
329336 // the channel start timestamp. That may still be wrong if lots of channel
330337 // instances start at the same time, but it's a lot better than combining the
331338 // instances badly.
332- if jobName == "" && platform == ibmmq .MQPL_ZOS {
339+ if jobName == DUMMY_STRING && platform == ibmmq .MQPL_ZOS {
333340 jobName = startDate + ":" + startTime
334341 }
335342 key = chlName + "/" + connName + "/" + rqmName + "/" + jobName
@@ -583,3 +590,13 @@ func parseChannelAttrData(cfh *ibmmq.MQCFH, buf []byte, infoMap map[string]*ObjI
583590
584591 return
585592}
593+
594+ func allZero (s string ) bool {
595+ rc := true
596+ for i := 0 ; i < len (s ); i ++ {
597+ if s [i ] != '0' {
598+ return false
599+ }
600+ }
601+ return rc
602+ }
0 commit comments