rippled
Loading...
Searching...
No Matches
CollectorManager.cpp
1#include <xrpld/app/main/CollectorManager.h>
2
3#include <memory>
4
5namespace ripple {
6
8{
9public:
13
15 : m_journal(journal)
16 {
17 std::string const& server = get(params, "server");
18
19 if (server == "statsd")
20 {
21 beast::IP::Endpoint const address(
22 beast::IP::Endpoint::from_string(get(params, "address")));
23 std::string const& prefix(get(params, "prefix"));
24
26 beast::insight::StatsDCollector::New(address, prefix, journal);
27 }
28 else
29 {
31 }
32
34 }
35
37
39 collector() override
40 {
41 return m_collector;
42 }
43
45 group(std::string const& name) override
46 {
47 return m_groups->get(name);
48 }
49};
50
51//------------------------------------------------------------------------------
52
55{
56 return std::make_unique<CollectorManagerImp>(params, journal);
57}
58
59} // namespace ripple
A version-independent IP address and port combination.
Definition IPEndpoint.h:19
static Endpoint from_string(std::string const &s)
A generic endpoint for log messages.
Definition Journal.h:41
virtual Group::ptr const & get(std::string const &name)=0
Find or create a new collector with a given name.
static std::shared_ptr< Collector > New()
static std::shared_ptr< StatsDCollector > New(IP::Endpoint const &address, std::string const &prefix, Journal journal)
Create a StatsD collector.
beast::insight::Collector::ptr const & collector() override
std::unique_ptr< beast::insight::Groups > m_groups
beast::insight::Collector::ptr m_collector
beast::insight::Group::ptr const & group(std::string const &name) override
CollectorManagerImp(Section const &params, beast::Journal journal)
Provides the beast::insight::Collector service.
Holds a collection of configuration values.
Definition BasicConfig.h:26
T is_same_v
std::unique_ptr< Groups > make_Groups(Collector::ptr const &collector)
Create a group container that uses the specified collector.
Definition Groups.cpp:118
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
std::unique_ptr< CollectorManager > make_CollectorManager(Section const &params, beast::Journal journal)
T get(Section const &section, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.