mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-23 23:30:54 +00:00
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.
60 lines
1.5 KiB
C++
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
|