Skip to content

Commit b786483

Browse files
committed
Add expiry to command requests
1 parent da1183e commit b786483

File tree

7 files changed

+16
-4
lines changed

7 files changed

+16
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
Newest updates are at the top of this file.
33

4+
## XXX XX 2025 - v5.6.5
5+
- mqmetric - Make command requests (and replies) expire after a while
6+
47
## Jun 16 2025 - v5.6.4
58
- Update for MQ 9.4.3
69
- mqmetric - Add MQTT metrics

ibmmq/mqiPCFstr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"strconv"
55
)
66

7-
// This file was created from the source tree on 2025-06-10 08:23:17
7+
// This file was created from the source tree on 2025-07-30 19:38:32
88

99
// This module converts a PCF integer type (from the MQIA* ranges) into
1010
// the prefix that can then be used to convert its value into a string

ibmmqotel/mqiotel.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func init() {
9797
os.Setenv("AMQ_OTEL_INSTRUMENTED", "true")
9898
}
9999

100-
// Go's locks are not concurrently accessible. So we need to add locks. This might not be required for
100+
// Go's maps are not concurrently accessible. So we need to add locks. This might not be required for
101101
// all operations, but better to be safe. These are trivial functions, but we might want to add tracing/debug
102102
// occasionally. So it's better to wrap the real calls.
103103
func lockMapOptions() {
@@ -143,7 +143,6 @@ func Setup() {
143143
GetTraceAfter: otelGetTraceAfter,
144144
}
145145
mq.SetOtelFuncs(f)
146-
147146
}
148147

149148
logTrace("OTelEnabled: %v", otelEnabled)

mqmetric/discover.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ func inquireObjectsWithFilter(objectPatternsList string, objectType int32, filte
885885
putmqmd.MsgType = ibmmq.MQMT_REQUEST
886886
putmqmd.Report = ibmmq.MQRO_PASS_DISCARD_AND_EXPIRY
887887

888+
putmqmd.Expiry = int32(ci.waitInterval) * EXPIRY_MULTIPLIER
889+
888890
cfh := ibmmq.NewMQCFH()
889891
cfh.Version = ibmmq.MQCFH_VERSION_3
890892
cfh.Type = ibmmq.MQCFT_COMMAND_XR

mqmetric/globals.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ const DUMMY_STRING = "-" // To provide a non-empty value for certain fields
117117
const DEFAULT_CONNECTION_KEY = "@defaultConnection"
118118
const DUMMY_PCFATTR = -1 // For metrics that don't have an explicit PCF attribute
119119

120+
// Command messages are put with an expiry so they don't hang around too long. And any remaining
121+
// responses are also set to expire because of an MQRO setting. We use the WaitInterval as the basis.
122+
// First multiply by 10 (to get from seconds to the tenths used in MQMD.Expiry), then give more time
123+
// than the actual waitInterval to allow traval in both directions + processing + a slop factor
124+
const EXPIRY_MULTIPLIER = 10 * 5
125+
120126
// This are used externally so we need to maintain them as public exports until
121127
// there's a major version change. At which point we will move them to fields of
122128
// the objectStatus structure, retrievable by a getXXX() call instead of as public

mqmetric/metrics.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,4 +374,4 @@ Class: bufferpool/pageset
374374
ATTR_PS_TOTAL : pages_total
375375
ATTR_PS_UNUSED : pages_unused
376376

377-
This page was automatically generated from the source tree on 2025-06-10 08:22:57
377+
This page was automatically generated from the source tree on 2025-07-30 19:38:07

mqmetric/status.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ func statusSetCommandHeaders() (*ibmmq.MQMD, *ibmmq.MQPMO, *ibmmq.MQCFH, []byte)
222222
putmqmd.MsgType = ibmmq.MQMT_REQUEST
223223
putmqmd.Report = ibmmq.MQRO_PASS_DISCARD_AND_EXPIRY
224224

225+
putmqmd.Expiry = int32(ci.waitInterval) * EXPIRY_MULTIPLIER
226+
225227
buf := make([]byte, 0)
226228

227229
traceExit("statusSetCommandHeaders", 0)

0 commit comments

Comments
 (0)