Skip to content

Commit 410f71c

Browse files
authored
mqbconf.xsd: Move flag to publish appId metircs from mqbcfg.xsd (#353)
* mqbconf.xsd: Add flag to publish appId metircs Signed-off-by: Yuan Jing Vincent Yan <[email protected]> * mqbcfg.xsd: Remove flag to publish appId metircs Signed-off-by: Yuan Jing Vincent Yan <[email protected]> * mqbstat::QueueStatsDomain: Use domain flag for publish appId metrics Signed-off-by: Yuan Jing Vincent Yan <[email protected]> * docs plugins.md: Remove appIdTagDomains Signed-off-by: Yuan Jing Vincent Yan <[email protected]> * configurator/__init__.py: Clean up removed config option Signed-off-by: Yuan Jing Vincent Yan <[email protected]> * mqbconf, mqbcfg: Generated Python code Signed-off-by: Yuan Jing Vincent Yan <[email protected]> * test_admin_client.py: Use new publish appId metrics flag Signed-off-by: Yuan Jing Vincent Yan <[email protected]> --------- Signed-off-by: Yuan Jing Vincent Yan <[email protected]>
1 parent f99b265 commit 410f71c

File tree

13 files changed

+1532
-2112
lines changed

13 files changed

+1532
-2112
lines changed

docs/docs/features/plugins.md

+1-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ By default, plugin is disabled. To enable and configure it, edit `bmqbrkcfg.json
3535
"appConfig": {
3636
"stats": {
3737
"snapshotInterval": 1,
38-
"appIdTagDomains": ["<fanout-domain-1-name>", "<fanout-domain-2-name>"],
3938
"plugins": [
4039
...
4140
{
@@ -44,7 +43,7 @@ By default, plugin is disabled. To enable and configure it, edit `bmqbrkcfg.json
4443
"prometheusSpecific": {
4544
"host": "localhost",
4645
"port": 9091,
47-
"mode": "E_PUSH"
46+
"mode": "E_PUSH"
4847
}
4948
}
5049
],
@@ -59,14 +58,6 @@ where
5958

6059
- `snapshotInterval`: represents how often stats are computed by broker
6160
internally, in seconds (typically every 1s);
62-
- [OPTIONAL] `appIdTagDomains`: used for troubleshooting, represents
63-
the list of *fanout* mode domains for which *applicationId* tag will be
64-
applied on `queue.confirm_time_max` and `queue.queue_time_max` metrics.
65-
It can be *extremely* useful to detect slow responding consumer by
66-
*applicationId*. If this setting is omitted/empty, or domain name not
67-
in the list - *applicationId* tag will not be applied;<br/>
68-
**NOTE**: This feature is available for all BlazingMQ broker roles except
69-
*PROXY*;
7061

7162
2. Prometheus plugin configuration
7263

src/groups/mqb/mqbcfg/mqbcfg.xsd

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
<complexType name='StatsConfig'>
129129
<sequence>
130130
<element name='snapshotInterval' type='int' default='1'/> <!-- 0 to disable -->
131-
<element name='appIdTagDomains' type='string' maxOccurs='unbounded'/>
132131
<element name='plugins' type='tns:StatPluginConfig' maxOccurs='unbounded'/>
133132
<element name='printer' type='tns:StatsPrinterConfig'/>
134133
</sequence>

src/groups/mqb/mqbcfg/mqbcfg_messages.cpp

+6-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018-2024 Bloomberg Finance L.P.
1+
// Copyright 2014-2024 Bloomberg Finance L.P.
22
// SPDX-License-Identifier: Apache-2.0
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -4984,11 +4984,6 @@ const bdlat_AttributeInfo StatsConfig::ATTRIBUTE_INFO_ARRAY[] = {
49844984
sizeof("snapshotInterval") - 1,
49854985
"",
49864986
bdlat_FormattingMode::e_DEC},
4987-
{ATTRIBUTE_ID_APP_ID_TAG_DOMAINS,
4988-
"appIdTagDomains",
4989-
sizeof("appIdTagDomains") - 1,
4990-
"",
4991-
bdlat_FormattingMode::e_TEXT},
49924987
{ATTRIBUTE_ID_PLUGINS,
49934988
"plugins",
49944989
sizeof("plugins") - 1,
@@ -5005,7 +5000,7 @@ const bdlat_AttributeInfo StatsConfig::ATTRIBUTE_INFO_ARRAY[] = {
50055000
const bdlat_AttributeInfo* StatsConfig::lookupAttributeInfo(const char* name,
50065001
int nameLength)
50075002
{
5008-
for (int i = 0; i < 4; ++i) {
5003+
for (int i = 0; i < 3; ++i) {
50095004
const bdlat_AttributeInfo& attributeInfo =
50105005
StatsConfig::ATTRIBUTE_INFO_ARRAY[i];
50115006

@@ -5023,8 +5018,6 @@ const bdlat_AttributeInfo* StatsConfig::lookupAttributeInfo(int id)
50235018
switch (id) {
50245019
case ATTRIBUTE_ID_SNAPSHOT_INTERVAL:
50255020
return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SNAPSHOT_INTERVAL];
5026-
case ATTRIBUTE_ID_APP_ID_TAG_DOMAINS:
5027-
return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_APP_ID_TAG_DOMAINS];
50285021
case ATTRIBUTE_ID_PLUGINS:
50295022
return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PLUGINS];
50305023
case ATTRIBUTE_ID_PRINTER:
@@ -5036,17 +5029,15 @@ const bdlat_AttributeInfo* StatsConfig::lookupAttributeInfo(int id)
50365029
// CREATORS
50375030

50385031
StatsConfig::StatsConfig(bslma::Allocator* basicAllocator)
5039-
: d_appIdTagDomains(basicAllocator)
5040-
, d_plugins(basicAllocator)
5032+
: d_plugins(basicAllocator)
50415033
, d_printer(basicAllocator)
50425034
, d_snapshotInterval(DEFAULT_INITIALIZER_SNAPSHOT_INTERVAL)
50435035
{
50445036
}
50455037

50465038
StatsConfig::StatsConfig(const StatsConfig& original,
50475039
bslma::Allocator* basicAllocator)
5048-
: d_appIdTagDomains(original.d_appIdTagDomains, basicAllocator)
5049-
, d_plugins(original.d_plugins, basicAllocator)
5040+
: d_plugins(original.d_plugins, basicAllocator)
50505041
, d_printer(original.d_printer, basicAllocator)
50515042
, d_snapshotInterval(original.d_snapshotInterval)
50525043
{
@@ -5055,17 +5046,15 @@ StatsConfig::StatsConfig(const StatsConfig& original,
50555046
#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \
50565047
defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
50575048
StatsConfig::StatsConfig(StatsConfig&& original) noexcept
5058-
: d_appIdTagDomains(bsl::move(original.d_appIdTagDomains)),
5059-
d_plugins(bsl::move(original.d_plugins)),
5049+
: d_plugins(bsl::move(original.d_plugins)),
50605050
d_printer(bsl::move(original.d_printer)),
50615051
d_snapshotInterval(bsl::move(original.d_snapshotInterval))
50625052
{
50635053
}
50645054

50655055
StatsConfig::StatsConfig(StatsConfig&& original,
50665056
bslma::Allocator* basicAllocator)
5067-
: d_appIdTagDomains(bsl::move(original.d_appIdTagDomains), basicAllocator)
5068-
, d_plugins(bsl::move(original.d_plugins), basicAllocator)
5057+
: d_plugins(bsl::move(original.d_plugins), basicAllocator)
50695058
, d_printer(bsl::move(original.d_printer), basicAllocator)
50705059
, d_snapshotInterval(bsl::move(original.d_snapshotInterval))
50715060
{
@@ -5082,7 +5071,6 @@ StatsConfig& StatsConfig::operator=(const StatsConfig& rhs)
50825071
{
50835072
if (this != &rhs) {
50845073
d_snapshotInterval = rhs.d_snapshotInterval;
5085-
d_appIdTagDomains = rhs.d_appIdTagDomains;
50865074
d_plugins = rhs.d_plugins;
50875075
d_printer = rhs.d_printer;
50885076
}
@@ -5096,7 +5084,6 @@ StatsConfig& StatsConfig::operator=(StatsConfig&& rhs)
50965084
{
50975085
if (this != &rhs) {
50985086
d_snapshotInterval = bsl::move(rhs.d_snapshotInterval);
5099-
d_appIdTagDomains = bsl::move(rhs.d_appIdTagDomains);
51005087
d_plugins = bsl::move(rhs.d_plugins);
51015088
d_printer = bsl::move(rhs.d_printer);
51025089
}
@@ -5108,7 +5095,6 @@ StatsConfig& StatsConfig::operator=(StatsConfig&& rhs)
51085095
void StatsConfig::reset()
51095096
{
51105097
d_snapshotInterval = DEFAULT_INITIALIZER_SNAPSHOT_INTERVAL;
5111-
bdlat_ValueTypeFunctions::reset(&d_appIdTagDomains);
51125098
bdlat_ValueTypeFunctions::reset(&d_plugins);
51135099
bdlat_ValueTypeFunctions::reset(&d_printer);
51145100
}
@@ -5121,7 +5107,6 @@ StatsConfig::print(bsl::ostream& stream, int level, int spacesPerLevel) const
51215107
bslim::Printer printer(&stream, level, spacesPerLevel);
51225108
printer.start();
51235109
printer.printAttribute("snapshotInterval", this->snapshotInterval());
5124-
printer.printAttribute("appIdTagDomains", this->appIdTagDomains());
51255110
printer.printAttribute("plugins", this->plugins());
51265111
printer.printAttribute("printer", this->printer());
51275112
printer.end();

src/groups/mqb/mqbcfg/mqbcfg_messages.h

+11-64
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018-2024 Bloomberg Finance L.P.
1+
// Copyright 2014-2024 Bloomberg Finance L.P.
22
// SPDX-License-Identifier: Apache-2.0
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -7922,7 +7922,6 @@ namespace mqbcfg {
79227922

79237923
class StatsConfig {
79247924
// INSTANCE DATA
7925-
bsl::vector<bsl::string> d_appIdTagDomains;
79267925
bsl::vector<StatPluginConfig> d_plugins;
79277926
StatsPrinterConfig d_printer;
79287927
int d_snapshotInterval;
@@ -7931,24 +7930,20 @@ class StatsConfig {
79317930
template <typename t_HASH_ALGORITHM>
79327931
void hashAppendImpl(t_HASH_ALGORITHM& hashAlgorithm) const;
79337932

7934-
bool isEqualTo(const StatsConfig& rhs) const;
7935-
79367933
public:
79377934
// TYPES
79387935
enum {
7939-
ATTRIBUTE_ID_SNAPSHOT_INTERVAL = 0,
7940-
ATTRIBUTE_ID_APP_ID_TAG_DOMAINS = 1,
7941-
ATTRIBUTE_ID_PLUGINS = 2,
7942-
ATTRIBUTE_ID_PRINTER = 3
7936+
ATTRIBUTE_ID_SNAPSHOT_INTERVAL = 0,
7937+
ATTRIBUTE_ID_PLUGINS = 1,
7938+
ATTRIBUTE_ID_PRINTER = 2
79437939
};
79447940

7945-
enum { NUM_ATTRIBUTES = 4 };
7941+
enum { NUM_ATTRIBUTES = 3 };
79467942

79477943
enum {
7948-
ATTRIBUTE_INDEX_SNAPSHOT_INTERVAL = 0,
7949-
ATTRIBUTE_INDEX_APP_ID_TAG_DOMAINS = 1,
7950-
ATTRIBUTE_INDEX_PLUGINS = 2,
7951-
ATTRIBUTE_INDEX_PRINTER = 3
7944+
ATTRIBUTE_INDEX_SNAPSHOT_INTERVAL = 0,
7945+
ATTRIBUTE_INDEX_PLUGINS = 1,
7946+
ATTRIBUTE_INDEX_PRINTER = 2
79527947
};
79537948

79547949
// CONSTANTS
@@ -8052,10 +8047,6 @@ class StatsConfig {
80528047
// Return a reference to the modifiable "SnapshotInterval" attribute of
80538048
// this object.
80548049

8055-
bsl::vector<bsl::string>& appIdTagDomains();
8056-
// Return a reference to the modifiable "AppIdTagDomains" attribute of
8057-
// this object.
8058-
80598050
bsl::vector<StatPluginConfig>& plugins();
80608051
// Return a reference to the modifiable "Plugins" attribute of this
80618052
// object.
@@ -8110,10 +8101,6 @@ class StatsConfig {
81108101
int snapshotInterval() const;
81118102
// Return the value of the "SnapshotInterval" attribute of this object.
81128103

8113-
const bsl::vector<bsl::string>& appIdTagDomains() const;
8114-
// Return a reference offering non-modifiable access to the
8115-
// "AppIdTagDomains" attribute of this object.
8116-
81178104
const bsl::vector<StatPluginConfig>& plugins() const;
81188105
// Return a reference offering non-modifiable access to the "Plugins"
81198106
// attribute of this object.
@@ -8128,7 +8115,9 @@ class StatsConfig {
81288115
// have the same value, and 'false' otherwise. Two attribute objects
81298116
// have the same value if each respective attribute has the same value.
81308117
{
8131-
return lhs.isEqualTo(rhs);
8118+
return lhs.snapshotInterval() == rhs.snapshotInterval() &&
8119+
lhs.plugins() == rhs.plugins() &&
8120+
lhs.printer() == rhs.printer();
81328121
}
81338122

81348123
friend bool operator!=(const StatsConfig& lhs, const StatsConfig& rhs)
@@ -16387,19 +16376,10 @@ void StatsConfig::hashAppendImpl(t_HASH_ALGORITHM& hashAlgorithm) const
1638716376
{
1638816377
using bslh::hashAppend;
1638916378
hashAppend(hashAlgorithm, this->snapshotInterval());
16390-
hashAppend(hashAlgorithm, this->appIdTagDomains());
1639116379
hashAppend(hashAlgorithm, this->plugins());
1639216380
hashAppend(hashAlgorithm, this->printer());
1639316381
}
1639416382

16395-
inline bool StatsConfig::isEqualTo(const StatsConfig& rhs) const
16396-
{
16397-
return this->snapshotInterval() == rhs.snapshotInterval() &&
16398-
this->appIdTagDomains() == rhs.appIdTagDomains() &&
16399-
this->plugins() == rhs.plugins() &&
16400-
this->printer() == rhs.printer();
16401-
}
16402-
1640316383
// CLASS METHODS
1640416384
// MANIPULATORS
1640516385
template <typename t_MANIPULATOR>
@@ -16413,13 +16393,6 @@ int StatsConfig::manipulateAttributes(t_MANIPULATOR& manipulator)
1641316393
return ret;
1641416394
}
1641516395

16416-
ret = manipulator(
16417-
&d_appIdTagDomains,
16418-
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_APP_ID_TAG_DOMAINS]);
16419-
if (ret) {
16420-
return ret;
16421-
}
16422-
1642316396
ret = manipulator(&d_plugins,
1642416397
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PLUGINS]);
1642516398
if (ret) {
@@ -16446,11 +16419,6 @@ int StatsConfig::manipulateAttribute(t_MANIPULATOR& manipulator, int id)
1644616419
&d_snapshotInterval,
1644716420
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SNAPSHOT_INTERVAL]);
1644816421
}
16449-
case ATTRIBUTE_ID_APP_ID_TAG_DOMAINS: {
16450-
return manipulator(
16451-
&d_appIdTagDomains,
16452-
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_APP_ID_TAG_DOMAINS]);
16453-
}
1645416422
case ATTRIBUTE_ID_PLUGINS: {
1645516423
return manipulator(&d_plugins,
1645616424
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PLUGINS]);
@@ -16484,11 +16452,6 @@ inline int& StatsConfig::snapshotInterval()
1648416452
return d_snapshotInterval;
1648516453
}
1648616454

16487-
inline bsl::vector<bsl::string>& StatsConfig::appIdTagDomains()
16488-
{
16489-
return d_appIdTagDomains;
16490-
}
16491-
1649216455
inline bsl::vector<StatPluginConfig>& StatsConfig::plugins()
1649316456
{
1649416457
return d_plugins;
@@ -16511,12 +16474,6 @@ int StatsConfig::accessAttributes(t_ACCESSOR& accessor) const
1651116474
return ret;
1651216475
}
1651316476

16514-
ret = accessor(d_appIdTagDomains,
16515-
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_APP_ID_TAG_DOMAINS]);
16516-
if (ret) {
16517-
return ret;
16518-
}
16519-
1652016477
ret = accessor(d_plugins, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PLUGINS]);
1652116478
if (ret) {
1652216479
return ret;
@@ -16541,11 +16498,6 @@ int StatsConfig::accessAttribute(t_ACCESSOR& accessor, int id) const
1654116498
d_snapshotInterval,
1654216499
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SNAPSHOT_INTERVAL]);
1654316500
}
16544-
case ATTRIBUTE_ID_APP_ID_TAG_DOMAINS: {
16545-
return accessor(
16546-
d_appIdTagDomains,
16547-
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_APP_ID_TAG_DOMAINS]);
16548-
}
1654916501
case ATTRIBUTE_ID_PLUGINS: {
1655016502
return accessor(d_plugins,
1655116503
ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PLUGINS]);
@@ -16579,11 +16531,6 @@ inline int StatsConfig::snapshotInterval() const
1657916531
return d_snapshotInterval;
1658016532
}
1658116533

16582-
inline const bsl::vector<bsl::string>& StatsConfig::appIdTagDomains() const
16583-
{
16584-
return d_appIdTagDomains;
16585-
}
16586-
1658716534
inline const bsl::vector<StatPluginConfig>& StatsConfig::plugins() const
1658816535
{
1658916536
return d_plugins;

src/groups/mqb/mqbconfm/mqbconf.xsd

+5-2
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,14 @@
270270
<documentation>
271271
Configuration for a fanout queue.
272272

273-
appIDs.: List of appIDs authorized to consume from the queue.
273+
appIDs.............: List of appIDs authorized to consume from the
274+
queue.
275+
publishAppIdMetrics: Whether to publish appId metrics.
274276
</documentation>
275277
</annotation>
276278
<sequence>
277-
<element name='appIDs' type='string' maxOccurs='unbounded'/>
279+
<element name='appIDs' type='string' maxOccurs='unbounded'/>
280+
<element name='publishAppIdMetrics' type='boolean' default='false'/>
278281
</sequence>
279282
</complexType>
280283

0 commit comments

Comments
 (0)