@@ -256,6 +256,12 @@ int Dispatcher::startContext(bsl::ostream& errorDescription,
256
256
DispatcherContext (config, d_allocator_p),
257
257
d_allocator_p);
258
258
259
+ context->d_statContext_mp =
260
+ mqbstat::DispatcherStatsUtil::initializeClientStatContext (
261
+ d_statContext_p,
262
+ mqbi::DispatcherClientType::toAscii (type),
263
+ d_allocator_p);
264
+
259
265
// Create and start the threadPool
260
266
context->d_threadPool_mp .load (
261
267
new (*d_allocator_p)
@@ -360,6 +366,8 @@ void Dispatcher::queueEventCb(mqbi::DispatcherClientType::Enum type,
360
366
case ProcessorPool::Event::MWCC_USER: {
361
367
BALL_LOG_TRACE << " Dispatching Event to queue " << processorId
362
368
<< " of " << type << " dispatcher: " << event->object ();
369
+ DispatcherContext& dispatcherContext = *(d_contexts[type]);
370
+
363
371
if (event->object ().type () ==
364
372
mqbi::DispatcherEventType::e_DISPATCHER) {
365
373
const mqbi::DispatcherDispatcherEvent* realEvent =
@@ -380,7 +388,6 @@ void Dispatcher::queueEventCb(mqbi::DispatcherClientType::Enum type,
380
388
}
381
389
}
382
390
else {
383
- DispatcherContext& dispatcherContext = *(d_contexts[type]);
384
391
event->object ().destination ()->onDispatcherEvent (event->object ());
385
392
if (!event->object ()
386
393
.destination ()
@@ -394,6 +401,11 @@ void Dispatcher::queueEventCb(mqbi::DispatcherClientType::Enum type,
394
401
.setAddedToFlushList (true );
395
402
}
396
403
}
404
+
405
+ dispatcherContext.d_statContext_mp ->adjustValue (
406
+ mqbstat::DispatcherStats::Stat::e_DONE_START +
407
+ event->object ().type (),
408
+ 1 );
397
409
} break ;
398
410
case ProcessorPool::Event::MWCC_QUEUE_EMPTY: {
399
411
flushClients (type, processorId);
@@ -449,11 +461,13 @@ void Dispatcher::onNewClient(mqbi::DispatcherClientType::Enum type,
449
461
}
450
462
451
463
Dispatcher::Dispatcher (const mqbcfg::DispatcherConfig& config,
464
+ mwcst::StatContext* statContext,
452
465
bdlmt::EventScheduler* scheduler,
453
466
bslma::Allocator* allocator)
454
467
: d_allocator_p(allocator)
455
468
, d_isStarted(false )
456
469
, d_config(config)
470
+ , d_statContext_p(statContext)
457
471
, d_scheduler_p(scheduler)
458
472
, d_contexts(allocator)
459
473
{
@@ -582,6 +596,9 @@ Dispatcher::registerClient(mqbi::DispatcherClient* client,
582
596
.setClientType (type)
583
597
.setProcessorHandle (processor);
584
598
599
+ context.d_statContext_mp ->adjustValue (
600
+ mqbstat::DispatcherStats::Stat::e_CLIENT_COUNT,
601
+ 1 );
585
602
BALL_LOG_DEBUG << " Registered a new client to the dispatcher "
586
603
<< " [Client: " << client->description ()
587
604
<< " , type: " << type << " , processor: " << processor
@@ -628,6 +645,9 @@ void Dispatcher::unregisterClient(mqbi::DispatcherClient* client)
628
645
case mqbi::DispatcherClientType::e_QUEUE:
629
646
case mqbi::DispatcherClientType::e_CLUSTER: {
630
647
d_contexts[type]->d_loadBalancer .removeClient (client);
648
+ d_contexts[type]->d_statContext_mp ->adjustValue (
649
+ mqbstat::DispatcherStats::Stat::e_CLIENT_COUNT,
650
+ -1 );
631
651
} break ;
632
652
case mqbi::DispatcherClientType::e_UNDEFINED:
633
653
case mqbi::DispatcherClientType::e_ALL:
0 commit comments