Files
rippled/src/xrpld/app/main/CollectorManager.cpp
Bart 1eb0fdac65 refactor: Rename ripple namespace to xrpl (#5982)
This change renames all occurrences of `namespace ripple` and `ripple::` to `namespace xrpl` and `xrpl::`, respectively, as well as the names of test suites. It also provides a script to allow developers to replicate the changes in their local branch or fork to avoid conflicts.
2025-12-11 16:51:49 +00:00

60 lines
1.5 KiB
C++

#include <xrpld/app/main/CollectorManager.h>
#include <memory>
namespace xrpl {
class CollectorManagerImp : public CollectorManager
{
public:
beast::Journal m_journal;
beast::insight::Collector::ptr m_collector;
std::unique_ptr<beast::insight::Groups> m_groups;
CollectorManagerImp(Section const& params, beast::Journal journal)
: m_journal(journal)
{
std::string const& server = get(params, "server");
if (server == "statsd")
{
beast::IP::Endpoint const address(
beast::IP::Endpoint::from_string(get(params, "address")));
std::string const& prefix(get(params, "prefix"));
m_collector =
beast::insight::StatsDCollector::New(address, prefix, journal);
}
else
{
m_collector = beast::insight::NullCollector::New();
}
m_groups = beast::insight::make_Groups(m_collector);
}
~CollectorManagerImp() = default;
beast::insight::Collector::ptr const&
collector() override
{
return m_collector;
}
beast::insight::Group::ptr const&
group(std::string const& name) override
{
return m_groups->get(name);
}
};
//------------------------------------------------------------------------------
std::unique_ptr<CollectorManager>
make_CollectorManager(Section const& params, beast::Journal journal)
{
return std::make_unique<CollectorManagerImp>(params, journal);
}
} // namespace xrpl