-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat[MQB]: Enhance queue consumption monitor alarm log with additional details #420
Changes from 27 commits
f02419e
122344f
9e23230
9117ac7
87cdf0b
8e88dc2
6dfd1fa
4ba1056
dcae5bf
7482e16
81a0854
2e29ae8
924c207
f279efd
8142686
2b5eaad
917e8a1
b1f9170
9bf33e6
66e3001
3c6651f
69da6c1
493b459
b972874
763563f
d092e76
d2a5164
e54b1b8
070baec
d4cf81d
1982cc2
76744df
a95ed92
265b77c
b29a25c
4e11d2d
6f7238f
1616eb0
85a3eef
88cd3df
c6c332e
f853ebf
24d2027
e1b55b8
047955c
b4e100f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
#include <bmqt_queueflags.h> | ||
|
||
// MWC | ||
#include <mwctsk_alarmlog.h> | ||
#include <mwctst_scopedlogobserver.h> | ||
#include <mwctst_testhelper.h> | ||
#include <mwcu_memoutstream.h> | ||
|
@@ -93,6 +94,17 @@ ClientContext::~ClientContext() | |
// NOTHING | ||
} | ||
|
||
static void loggingCb(BSLS_ANNOTATION_UNUSED const mqbu::StorageKey& appKey, | ||
BSLS_ANNOTATION_UNUSED const | ||
bslma::ManagedPtr<mqbi::StorageIterator>& head) | ||
{ | ||
BALL_LOG_SET_CATEGORY("MQBBLP.QUEUECONSUMPTIONMONITORTEST"); | ||
|
||
mwcu::MemOutStream out(s_allocator_p); | ||
out << "Test Alarm"; | ||
MWCTSK_ALARMLOG_ALARM("QUEUE_STUCK") << out.str() << MWCTSK_ALARMLOG_END; | ||
} | ||
|
||
struct Test : mwctst::Test { | ||
typedef bsl::vector< | ||
bsl::pair<mqbi::QueueHandle*, bmqp_ctrlmsg::QueueHandleParameters> > | ||
|
@@ -152,7 +164,7 @@ Test::Test() | |
d_partitionId, | ||
&d_domain, | ||
s_allocator_p) | ||
, d_monitor(&d_queueState, s_allocator_p) | ||
, d_monitor(&d_queueState, &loggingCb, s_allocator_p) | ||
, d_storage(d_queue.uri(), | ||
mqbu::StorageKey::k_NULL_KEY, | ||
mqbs::DataStore::k_INVALID_PARTITION_ID, | ||
|
@@ -386,11 +398,7 @@ TEST_F(Test, logFormat) | |
ASSERT_EQ(logObserver.records().size(), 1u); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().back(), | ||
"ALARM \\[QUEUE_CONSUMER_MONITOR\\]", | ||
s_allocator_p)); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().back(), | ||
"Queue '.*'", | ||
"ALARM \\[QUEUE_STUCK\\]", | ||
s_allocator_p)); | ||
} | ||
|
||
|
@@ -440,11 +448,7 @@ TEST_F(Test, putAliveIdleSendAlive) | |
ASSERT_EQ(logObserver.records().size(), ++expectedLogRecords); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().back(), | ||
"ALARM \\[QUEUE_CONSUMER_MONITOR\\]", | ||
s_allocator_p)); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().back(), | ||
"0 consumers", | ||
"ALARM \\[QUEUE_STUCK\\]", | ||
s_allocator_p)); | ||
|
||
d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 2); | ||
|
@@ -503,19 +507,7 @@ TEST_F(Test, putAliveIdleWithConsumer) | |
ASSERT_EQ(logObserver.records().size(), ++expectedLogRecords); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().back(), | ||
"ALARM \\[QUEUE_CONSUMER_MONITOR\\].*It currently has 2 consumers", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I understand, there is no "test consumer 1/2" log because it is outside of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored the test by simplifying logic and removing consumers, but still need |
||
s_allocator_p)); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().back(), | ||
"test consumer 1", | ||
s_allocator_p)); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().back(), | ||
"test consumer 2", | ||
s_allocator_p)); | ||
ASSERT(!mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().back(), | ||
"test producer", | ||
"ALARM \\[QUEUE_STUCK\\]", | ||
s_allocator_p)); | ||
} | ||
|
||
|
@@ -689,11 +681,7 @@ TEST_F(Test, putAliveIdleSendAliveTwoSubstreams) | |
for (int i = 0; i < 2; ++i) { | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().rbegin()[i], | ||
"ALARM \\[QUEUE_CONSUMER_MONITOR\\]", | ||
s_allocator_p)); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
logObserver.records().rbegin()[i], | ||
"0 consumers", | ||
"ALARM \\[QUEUE_STUCK\\]", | ||
s_allocator_p)); | ||
} | ||
|
||
|
@@ -797,21 +785,8 @@ TEST_F(Test, putAliveIdleSendAliveTwoSubstreamsTwoConsumers) | |
++iter) { | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
*iter, | ||
"ALARM \\[QUEUE_CONSUMER_MONITOR\\] Queue " | ||
"'bmq://bmq.test.local/test_queue\\?id=app\\d'", | ||
s_allocator_p)); | ||
ASSERT( | ||
mwctst::ScopedLogObserverUtil::recordMessageMatch(*iter, | ||
"1 consumers", | ||
s_allocator_p)); | ||
ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( | ||
*iter, | ||
"test consumer \\d", | ||
"ALARM \\[QUEUE_STUCK\\]", | ||
s_allocator_p)); | ||
ASSERT( | ||
!mwctst::ScopedLogObserverUtil::recordMessageMatch(*iter, | ||
"test producer", | ||
s_allocator_p)); | ||
} | ||
|
||
d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 2); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also need to mention
loggingCb