rippled
Loading...
Searching...
No Matches
CollectorManager.cpp
1#include <xrpld/app/main/CollectorManager.h>
2
3#include <memory>
4
5namespace xrpl {
6
8{
9public:
13
14 CollectorManagerImp(Section const& params, beast::Journal journal) : m_journal(journal)
15 {
16 std::string const& server = get(params, "server");
17
18 if (server == "statsd")
19 {
20 beast::IP::Endpoint const address(beast::IP::Endpoint::from_string(get(params, "address")));
21 std::string const& prefix(get(params, "prefix"));
22
23 m_collector = beast::insight::StatsDCollector::New(address, prefix, journal);
24 }
25 else
26 {
28 }
29
31 }
32
34
36 collector() override
37 {
38 return m_collector;
39 }
40
42 group(std::string const& name) override
43 {
44 return m_groups->get(name);
45 }
46};
47
48//------------------------------------------------------------------------------
49
52{
53 return std::make_unique<CollectorManagerImp>(params, journal);
54}
55
56} // namespace xrpl
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.
CollectorManagerImp(Section const &params, beast::Journal journal)
beast::insight::Collector::ptr m_collector
beast::insight::Collector::ptr const & collector() override
beast::insight::Group::ptr const & group(std::string const &name) override
std::unique_ptr< beast::insight::Groups > m_groups
Provides the beast::insight::Collector service.
Holds a collection of configuration values.
Definition BasicConfig.h:25
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:115
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
T get(Section const &section, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
std::unique_ptr< CollectorManager > make_CollectorManager(Section const &params, beast::Journal journal)