Skip to content

Commit 7002f95

Browse files
committed
Fix: Require latency monitoring domain to match prefix
Latency monitoring domains are an under-documented feature of BlazingMQ that can be used to measure end-to-end message latency through the broker. To support partition-aware latency measurement, the broker parses queue names on these domains using this regex (src/groups/mqb/mqbc/mqbc_clusterstate.cpp:765): ^\S+\.([0-9]+)\.\S+\.\S+$ An example string that matches this is: foo.2.bar.baz If a queue name matches this regex, the integer in the second component (e.g., `2` in `foo.2.bar.baz`) is treated as the target partition, and the queue is assigned to that partition. Latency monitoring domains are expected to start with a configured prefix (by default `bmq.sys.latemon.latency`, see src/groups/mqb/mqbcfg/mqbcfg.xsd:102). However, the existing implementation matches the configured prefix *anywhere* within the domain name. This patch fixes this behavior: domains are not recognized as latency monitoring domains only if they begin with the configured prefix. Signed-off-by: Patrick M. Niedzielski <[email protected]>
1 parent 89e90cc commit 7002f95

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/groups/mqb/mqbc/mqbc_clusterutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ int ClusterUtil::getNextPartitionId(const ClusterState& clusterState,
523523
const bsl::string& latencyMonitorDomain =
524524
mqbcfg::BrokerConfig::get().latencyMonitorDomain();
525525

526-
if (domainName.find(latencyMonitorDomain) != bsl::string::npos) {
526+
if (domainName.starts_with(latencyMonitorDomain)) {
527527
// latemon domain
528528
const int partitionId = clusterState.extractPartitionId(queueName);
529529
if (partitionId < 0) {

src/groups/mqb/mqbcfg/mqbcfg.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
hostDataCenter.......: datacenter the current host resides in
7878
isRunningOnDev.......: true if running on dev
7979
logsObserverMaxSize..: maximum number of log records to keep
80-
latencyMonitorDomain.: common part of all latemon domains
80+
latencyMonitorDomain.: common prefix of all latemon domains
8181
dispatcherConfig.....: configuration for the dispatcher
8282
stats................: configuration for the stats
8383
networkInterfaces....: configuration for the network interfaces

0 commit comments

Comments
 (0)