Skip to content
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

[WIP]Feat[MQB]: count plugins allocations #386

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/groups/mqb/mqba/mqba_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ int Application::start(bsl::ostream& errorDescription)

// Start the PluginManager
{
d_pluginManager_mp.load(new (*d_allocator_p)
mqbplug::PluginManager(d_allocator_p),
d_pluginManager_mp.load(new (*d_allocator_p) mqbplug::PluginManager(
d_allocators.get("PluginManager")),
d_allocator_p);
rc = d_pluginManager_mp->start(mqbcfg::BrokerConfig::get().plugins(),
errorDescription);
Expand Down
12 changes: 10 additions & 2 deletions src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,18 +772,26 @@ int StatController::start(bsl::ostream& errorDescription)

// Initialize StatConsumers from plugins.
{
PluginFactories pluginFactories(d_allocator_p);
bslma::Allocator* pluginFactoriesAllocator = d_allocators.get(
"PluginFactories");

PluginFactories pluginFactories(pluginFactoriesAllocator);
d_pluginManager_p->get(mqbplug::PluginType::e_STATS_CONSUMER,
&pluginFactories);

PluginFactories::const_iterator factoryIt = pluginFactories.cbegin();
for (; factoryIt != pluginFactories.cend(); ++factoryIt) {
// The current implementation of plugins doesn't allow to retrieve
// a plugin name directly from the PluginFactory, without building
// a new instance of StatConsumer
bslma::Allocator* pluginAllocator = d_allocators.get("Plugin");

mqbplug::StatConsumerPluginFactory* factory =
dynamic_cast<mqbplug::StatConsumerPluginFactory*>(*factoryIt);
StatConsumerMp consumer = factory->create(ctxPtrMap,
d_commandProcessorFn,
d_bufferFactory_p,
d_allocator_p);
pluginAllocator);

if (int status = consumer->start(errorStream)) {
MWCTSK_ALARMLOG_ALARM("#STATS")
Expand Down
Loading