diff --git a/src/70-graphite/CMakeLists.txt b/src/70-graphite/CMakeLists.txt index 30e7d5480f0..7868e68a4af 100644 --- a/src/70-graphite/CMakeLists.txt +++ b/src/70-graphite/CMakeLists.txt @@ -1,7 +1,5 @@ -## -## Copyright 2013 Centreon -## -## Licensed under the Apache License, Version 2.0 (the "License"); +####Copyright 2013 Centreon####Licensed under the Apache License, + Version 2.0(the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## @@ -19,9 +17,9 @@ include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CONAN_INCLUDE_DIRS_JSON11}) include_directories(${CONAN_INCLUDE_DIRS_SPDLOG}) -# TLS module. +#TLS module. add_library(70-graphite SHARED - # Sources +#Sources ${CMAKE_SOURCE_DIR}/src/70-graphite/connector.cc ${CMAKE_SOURCE_DIR}/src/70-graphite/factory.cc ${CMAKE_SOURCE_DIR}/src/70-graphite/macro_cache.cc @@ -30,5 +28,5 @@ add_library(70-graphite SHARED ${CMAKE_SOURCE_DIR}/src/70-graphite/stream.cc ) set_target_properties(70-graphite PROPERTIES PREFIX "") -target_link_libraries(70-graphite CONAN_PKG::asio) +target_link_libraries(70-graphite CONAN_PKG::asio CONAN_PKG::fmt) install(TARGETS 70-graphite DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/centreon/lib/centreon-broker) diff --git a/src/70-graphite/factory.cc b/src/70-graphite/factory.cc index 9581317e00d..97068eaeee4 100644 --- a/src/70-graphite/factory.cc +++ b/src/70-graphite/factory.cc @@ -21,9 +21,10 @@ #include #include #include "com/centreon/broker/config/parser.hh" -#include "com/centreon/broker/exceptions/msg.hh" +#include "com/centreon/exceptions/msg_fmt.hh" #include "com/centreon/broker/graphite/connector.hh" +using namespace com::centreon::exceptions; using namespace com::centreon::broker; using namespace com::centreon::broker::graphite; @@ -45,8 +46,7 @@ static std::string find_param(config::endpoint const& cfg, std::string const& key) { std::map::const_iterator it{cfg.params.find(key)}; if (cfg.params.end() == it) - throw exceptions::msg() << "graphite: no '" << key - << "' defined for endpoint '" << cfg.name << "'"; + throw msg_fmt("graphite: no '{}' defined for endpoint '{}'", key, cfg.name); return it->second; } @@ -79,17 +79,18 @@ static std::string get_string_param(config::endpoint const& cfg, * @return Property value. */ static uint32_t get_uint_param(config::endpoint const& cfg, - std::string const& key, - uint32_t def) { + std::string const& key, + uint32_t def) { std::map::const_iterator it(cfg.params.find(key)); if (cfg.params.end() == it) return (def); else { try { return std::stoul(it->second); - } catch (std::exception const& ex) { - throw exceptions::msg() << "graphite: '" << key - << "' must be numeric for endpoint '" << cfg.name << "'"; + } + catch (std::exception const& ex) { + throw msg_fmt( + "graphite: '{}' must be numeric for endpoint '{}'", key, cfg.name); } } @@ -127,10 +128,10 @@ bool factory::has_endpoint(config::endpoint& cfg) const { * * @return Endpoint matching the given configuration. */ -io::endpoint* factory::new_endpoint( - config::endpoint& cfg, - bool& is_acceptor, - std::shared_ptr cache) const { +io::endpoint* factory::new_endpoint(config::endpoint& cfg, + bool& is_acceptor, + std::shared_ptr cache) + const { std::string db_host(find_param(cfg, "db_host")); unsigned short db_port(get_uint_param(cfg, "db_port", 2003)); std::string db_user(get_string_param(cfg, "db_user", "")); @@ -145,8 +146,15 @@ io::endpoint* factory::new_endpoint( // Connector. std::unique_ptr c(new graphite::connector); - c->connect_to(metric_naming, status_naming, escape_string, db_user, - db_password, db_host, db_port, queries_per_transaction, cache); + c->connect_to(metric_naming, + status_naming, + escape_string, + db_user, + db_password, + db_host, + db_port, + queries_per_transaction, + cache); is_acceptor = false; return (c.release()); } diff --git a/src/70-graphite/macro_cache.cc b/src/70-graphite/macro_cache.cc index 92e068531d0..55bd6d066a6 100644 --- a/src/70-graphite/macro_cache.cc +++ b/src/70-graphite/macro_cache.cc @@ -17,9 +17,10 @@ */ #include "com/centreon/broker/graphite/macro_cache.hh" -#include "com/centreon/broker/exceptions/msg.hh" +#include "com/centreon/exceptions/msg_fmt.hh" #include "com/centreon/broker/logging/logging.hh" +using namespace com::centreon::exceptions; using namespace com::centreon::broker; using namespace com::centreon::broker::graphite; @@ -46,7 +47,8 @@ macro_cache::~macro_cache() { if (_cache != nullptr) { try { _save_to_disk(); - } catch (std::exception const& e) { + } + catch (std::exception const& e) { logging::error(logging::medium) << "graphite: macro cache couldn't save data to disk: '" << e.what() << "'"; @@ -61,12 +63,12 @@ macro_cache::~macro_cache() { * * @return The status mapping. */ -storage::index_mapping const& macro_cache::get_index_mapping( - uint64_t index_id) const { +storage::index_mapping const& macro_cache::get_index_mapping(uint64_t index_id) + const { auto found = _index_mappings.find(index_id); if (found == _index_mappings.end()) - throw exceptions::msg() - << "graphite: could not find host/service of index " << index_id; + throw msg_fmt("graphite: could not find host/service of index {}", + index_id); return *found->second; } @@ -81,8 +83,7 @@ storage::metric_mapping const& macro_cache::get_metric_mapping( uint64_t metric_id) const { auto const found = _metric_mappings.find(metric_id); if (found == _metric_mappings.end()) - throw exceptions::msg() << "graphite: could not find index of metric " - << metric_id; + throw msg_fmt("graphite: could not find index of metric {}", metric_id); return *found->second; } @@ -96,8 +97,7 @@ storage::metric_mapping const& macro_cache::get_metric_mapping( std::string const& macro_cache::get_host_name(uint64_t host_id) const { auto const found = _hosts.find(host_id); if (found == _hosts.end()) - throw exceptions::msg() << "graphite: could not find information on host " - << host_id; + throw msg_fmt("graphite: could not find information on host {}", host_id); return found->second->host_name; } @@ -114,9 +114,9 @@ std::string const& macro_cache::get_service_description(uint64_t host_id, const { auto const found = _services.find({host_id, service_id}); if (found == _services.end()) - throw exceptions::msg() - << "graphite: could not find information on service (" << host_id - << ", " << service_id << ")"; + throw msg_fmt("graphite: could not find information on service ({},{})", + host_id, + service_id); return found->second->service_description; } @@ -130,8 +130,8 @@ std::string const& macro_cache::get_service_description(uint64_t host_id, std::string const& macro_cache::get_instance(uint64_t instance_id) const { auto const found = _instances.find(instance_id); if (found == _instances.end()) - throw exceptions::msg() - << "graphite: could not find information on instance " << instance_id; + throw msg_fmt("graphite: could not find information on instance {}", + instance_id); return found->second->name; } diff --git a/src/70-graphite/query.cc b/src/70-graphite/query.cc index 3a4f838215f..78cc449160d 100644 --- a/src/70-graphite/query.cc +++ b/src/70-graphite/query.cc @@ -19,10 +19,11 @@ #include "com/centreon/broker/graphite/query.hh" #include #include -#include "com/centreon/broker/exceptions/msg.hh" +#include "com/centreon/exceptions/msg_fmt.hh" #include "com/centreon/broker/logging/logging.hh" #include "com/centreon/broker/misc/string.hh" +using namespace com::centreon::exceptions; using namespace com::centreon::broker; using namespace com::centreon::broker::graphite; @@ -39,10 +40,10 @@ query::query(std::string const& naming_scheme, std::string const& escape_string, data_type type, macro_cache const& cache) - : _escape_string(escape_string), - _naming_scheme_index(0), - _type(type), - _cache(&cache) { + : _escape_string(escape_string), + _naming_scheme_index(0), + _type(type), + _cache(&cache) { _compile_naming_scheme(naming_scheme, type); } @@ -55,27 +56,29 @@ query::query(std::string const& naming_scheme, */ std::string query::generate_metric(storage::metric const& me) { if (_type != metric) - throw (exceptions::msg() << "graphite: attempt to generate metric" - " with a query of the bad type"); + throw msg_fmt( + "graphite: attempt to generate metric with a query of the bad type"); _naming_scheme_index = 0; std::ostringstream iss; std::ostringstream tmp; try { - for (std::vector::const_iterator - it(_compiled_getters.begin()), - end(_compiled_getters.end()); - it != end; ++it) { + for (std::vector< + void (query::*)(io::data const&, std::ostream&)>::const_iterator + it(_compiled_getters.begin()), + end(_compiled_getters.end()); + it != end; + ++it) { (this->**it)(me, tmp); std::string escaped = tmp.str(); misc::string::replace(escaped, " ", "_"); iss << escaped; tmp.str(""); } - } catch (std::exception const& e) { + } + catch (std::exception const& e) { logging::error(logging::high) - << "graphite: couldn't generate query for metric " << me.metric_id - << ":" << e.what(); + << "graphite: couldn't generate query for metric " << me.metric_id + << ":" << e.what(); return (""); } @@ -93,27 +96,29 @@ std::string query::generate_metric(storage::metric const& me) { */ std::string query::generate_status(storage::status const& st) { if (_type != status) - throw (exceptions::msg() << "graphite: attempt to generate status" - " with a query of the bad type"); + throw msg_fmt( + "graphite: attempt to generate status with a query of the bad type"); _naming_scheme_index = 0; std::ostringstream iss; std::ostringstream tmp; try { - for (std::vector::const_iterator - it(_compiled_getters.begin()), - end(_compiled_getters.end()); - it != end; ++it) { + for (std::vector< + void (query::*)(io::data const&, std::ostream&)>::const_iterator + it(_compiled_getters.begin()), + end(_compiled_getters.end()); + it != end; + ++it) { (this->**it)(st, tmp); std::string escaped = tmp.str(); misc::string::replace(escaped, " ", "_"); iss << escaped; tmp.str(""); } - } catch (std::exception const& e) { + } + catch (std::exception const& e) { logging::error(logging::high) - << "graphite: couldn't generate query for status " << st.index_id << ":" - << e.what(); + << "graphite: couldn't generate query for status " << st.index_id << ":" + << e.what(); return (""); } @@ -130,39 +135,40 @@ std::string query::generate_status(storage::status const& st) { */ void query::_compile_naming_scheme(std::string const& naming_scheme, data_type type) { - (void) type; + (void)type; size_t found_macro = 0; size_t end_macro = 0; while ((found_macro = naming_scheme.find_first_of('$', found_macro)) != - std::string::npos) { + std::string::npos) { std::string substr = - naming_scheme.substr(end_macro, found_macro - end_macro); + naming_scheme.substr(end_macro, found_macro - end_macro); if (!substr.empty()) { _compiled_naming_scheme.push_back(substr); _compiled_getters.push_back(&query::_get_string); } if ((end_macro = naming_scheme.find_first_of('$', found_macro + 1)) == - std::string::npos) - throw exceptions::msg() - << "graphite: can't compile query, opened macro not closed: '" - << naming_scheme.substr(found_macro) << "'"; + std::string::npos) + throw msg_fmt( + "graphite: can't compile query, opened macro not closed: '{}'", + naming_scheme.substr(found_macro)); std::string macro{ - naming_scheme.substr(found_macro, end_macro + 1 - found_macro)}; + naming_scheme.substr(found_macro, end_macro + 1 - found_macro)}; if (macro == "$$") _compiled_getters.push_back(&query::_get_dollar_sign); if (macro == "$METRICID$") { _throw_on_invalid(metric); _compiled_getters.push_back( - &query::_get_member); + &query::_get_member); } else if (macro == "$INSTANCE$") _compiled_getters.push_back(&query::_get_instance); else if (macro == "$INSTANCEID$") _compiled_getters.push_back( - &query::_get_member); + &query::_get_member); else if (macro == "$HOST$") _compiled_getters.push_back(&query::_get_host); else if (macro == "$HOSTID$") @@ -174,12 +180,12 @@ void query::_compile_naming_scheme(std::string const& naming_scheme, else if (macro == "$METRIC$") { _throw_on_invalid(metric); _compiled_getters.push_back( - &query::_get_string_member); + &query::_get_string_member); } else if (macro == "$INDEXID$") { _compiled_getters.push_back(&query::_get_index_id); } else - logging::config(logging::high) - << "graphite: unknown macro '" << macro << "': ignoring it"; + logging::config(logging::high) << "graphite: unknown macro '" << macro + << "': ignoring it"; found_macro = end_macro = end_macro + 1; } std::string substr = naming_scheme.substr(end_macro, found_macro - end_macro); @@ -214,7 +220,7 @@ std::string query::_escape(std::string const& str) { */ void query::_throw_on_invalid(data_type macro_type) { if (macro_type != _type) - throw exceptions::msg() << "graphite: macro of invalid type"; + throw msg_fmt("graphite: macro of invalid type"); } /* @@ -227,7 +233,7 @@ void query::_throw_on_invalid(data_type macro_type) { * @param[in] d The data. * @param[out] is The stream. */ -template +template void query::_get_member(io::data const& d, std::ostream& is) { is << static_cast(&d)->*member; } @@ -238,7 +244,7 @@ void query::_get_member(io::data const& d, std::ostream& is) { * @param[in] d The data. * @param[out] is The stream. */ -template +template void query::_get_string_member(io::data const& d, std::ostream& is) { is << _escape(static_cast(&d)->*member); } @@ -250,7 +256,7 @@ void query::_get_string_member(io::data const& d, std::ostream& is) { * @param[out] is The stream. */ void query::_get_string(io::data const& d, std::ostream& is) { - (void) d; + (void)d; is << _compiled_naming_scheme[_naming_scheme_index++]; } @@ -261,7 +267,7 @@ void query::_get_string(io::data const& d, std::ostream& is) { * @param[in] is The stream. */ void query::_get_dollar_sign(io::data const& d, std::ostream& is) { - (void) d; + (void)d; is << "$"; } @@ -276,10 +282,8 @@ uint64_t query::_get_index_id(io::data const& d) { if (_type == status) return (static_cast(d).index_id); else - return (_cache - ->get_metric_mapping( - static_cast(d).metric_id) - .index_id); + return (_cache->get_metric_mapping(static_cast(d) + .metric_id).index_id); } /** @@ -300,11 +304,11 @@ void query::_get_index_id(io::data const& d, std::ostream& is) { */ void query::_get_host(io::data const& d, std::ostream& is) { if (_type == status) - is - << _escape(_cache->get_host_name(_cache->get_index_mapping(_get_index_id(d)).host_id)); + is << _escape(_cache->get_host_name( + _cache->get_index_mapping(_get_index_id(d)).host_id)); else - is - << _escape(_cache->get_host_name(static_cast(d).host_id)); + is << _escape(_cache->get_host_name( + static_cast(d).host_id)); } /** @@ -328,13 +332,13 @@ void query::_get_host_id(io::data const& d, std::ostream& is) { */ void query::_get_service(io::data const& d, std::ostream& is) { if (_type == status) { - storage::index_mapping const - & stm = _cache->get_index_mapping(_get_index_id(d)); + storage::index_mapping const& stm = + _cache->get_index_mapping(_get_index_id(d)); is << _escape(_cache->get_service_description(stm.host_id, stm.service_id)); } else - is - << _escape(_cache->get_service_description(static_cast(d).host_id, - static_cast(d).service_id)); + is << _escape(_cache->get_service_description( + static_cast(d).host_id, + static_cast(d).service_id)); } /** diff --git a/src/70-graphite/stream.cc b/src/70-graphite/stream.cc index a9c08645b6f..324d7eff17d 100644 --- a/src/70-graphite/stream.cc +++ b/src/70-graphite/stream.cc @@ -18,7 +18,7 @@ #include "com/centreon/broker/graphite/stream.hh" #include -#include "com/centreon/broker/exceptions/msg.hh" +#include "com/centreon/exceptions/msg_fmt.hh" #include "com/centreon/broker/exceptions/shutdown.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/logging/logging.hh" @@ -30,6 +30,7 @@ #include "com/centreon/broker/storage/metric.hh" using namespace asio; +using namespace com::centreon::exceptions; using namespace com::centreon::broker; using namespace com::centreon::broker::graphite; @@ -99,22 +100,26 @@ stream::stream(std::string const& metric_naming, } if (err) { - throw exceptions::msg() - << "graphite: can't connect to graphite on host '" << _db_host - << "', port '" << _db_port << "': " << err.message(); + throw msg_fmt( + "graphite: can't connect to graphite on host '{}', port '{}': {}", + _db_host, + _db_port, + err.message()); } - } catch (std::system_error const& se) { - throw exceptions::msg() - << "graphite: can't connect to graphite on host '" << _db_host - << "', port '" << _db_port << "': " << se.what(); + } + catch (std::system_error const& se) { + throw msg_fmt( + "graphite: can't connect to graphite on host '{}', port '{}': {}", + _db_host, + _db_port, + se.what()); } } /** * Destructor. */ -stream::~stream() { -} +stream::~stream() {} /** * Flush the stream. @@ -122,8 +127,8 @@ stream::~stream() { * @return Number of events acknowledged. */ int stream::flush() { - logging::debug(logging::medium) - << "graphite: commiting " << _actual_query << " queries"; + logging::debug(logging::medium) << "graphite: commiting " << _actual_query + << " queries"; int ret(_pending_queries); if (_actual_query != 0) _commit(); @@ -159,7 +164,6 @@ void stream::statistics(json11::Json::object& tree) const { tree["status"] = _status; } - /** * Write an event. * @@ -232,9 +236,11 @@ void stream::_commit() { asio::write(_socket, buffer(_query), asio::transfer_all(), err); if (err) - throw exceptions::msg() - << "graphite: can't send data to graphite on host '" << _db_host - << "', port '" << _db_port << "': " << err.message(); + throw msg_fmt( + "graphite: can't send data to graphite on host '{}', port '{}': {}", + _db_host, + _db_port, + err.message()); _query.clear(); _query.append(_auth_query); diff --git a/tests/broker/graphite/factory.cc b/tests/broker/graphite/factory.cc index 528fa0431d1..10edc8f956b 100644 --- a/tests/broker/graphite/factory.cc +++ b/tests/broker/graphite/factory.cc @@ -19,8 +19,9 @@ #include "com/centreon/broker/graphite/factory.hh" #include -#include "com/centreon/broker/exceptions/msg.hh" +#include "com/centreon/exceptions/msg_fmt.hh" +using namespace com::centreon::exceptions; using namespace com::centreon::broker; TEST(graphiteFactory, HasEndpoint) { @@ -41,7 +42,7 @@ TEST(graphiteFactory, MissingParams) { std::shared_ptr cache; bool is_acceptor; - ASSERT_THROW(fact.new_endpoint(cfg, is_acceptor, cache), exceptions::msg); + ASSERT_THROW(fact.new_endpoint(cfg, is_acceptor, cache), msg_fmt); cfg.params["db_host"] = "host"; ASSERT_NO_THROW(delete fact.new_endpoint(cfg, is_acceptor, cache)); cfg.params["db_port"] = "toto"; diff --git a/tests/broker/graphite/query.cc b/tests/broker/graphite/query.cc index e2274c3cc9b..8240b4d729f 100644 --- a/tests/broker/graphite/query.cc +++ b/tests/broker/graphite/query.cc @@ -19,9 +19,10 @@ #include "com/centreon/broker/graphite/query.hh" #include -#include "com/centreon/broker/exceptions/msg.hh" +#include "com/centreon/exceptions/msg_fmt.hh" #include "com/centreon/broker/logging/manager.hh" +using namespace com::centreon::exceptions; using namespace com::centreon::broker; TEST(graphiteQuery, ComplexMetric) { @@ -121,35 +122,38 @@ TEST(graphiteQuery, Except) { graphite::query q2{"test .", "a", graphite::query::status, cache}; try { - graphite::query q3{"test . $METRICID$", "a", graphite::query::status, - cache}; + graphite::query q3{"test . $METRICID$", "a", + graphite::query::status, cache}; ASSERT_TRUE(false); - } catch (exceptions::msg const& ex) { + } + catch (msg_fmt const& ex) { ASSERT_TRUE(true); } try { graphite::query q3{"test . $METRIC$", "a", graphite::query::status, cache}; ASSERT_TRUE(false); - } catch (exceptions::msg const& ex) { + } + catch (msg_fmt const& ex) { ASSERT_TRUE(true); } try { graphite::query q3{"test . $METRIC", "a", graphite::query::status, cache}; ASSERT_TRUE(false); - } catch (exceptions::msg const& ex) { + } + catch (msg_fmt const& ex) { ASSERT_TRUE(true); } m.metric_id = 3; m.name = "A"; - graphite::query q4{"test . $METRICID$ $METRIC$", "a", graphite::query::metric, - cache}; + graphite::query q4{"test . $METRICID$ $METRIC$", "a", + graphite::query::metric, cache}; - ASSERT_THROW(q.generate_status(s), exceptions::msg); - ASSERT_THROW(q2.generate_metric(m), exceptions::msg); + ASSERT_THROW(q.generate_status(s), msg_fmt); + ASSERT_THROW(q2.generate_metric(m), msg_fmt); ASSERT_EQ(q4.generate_metric(m), "test_._3_A nan 0\n"); graphite::query q5{"test . $INSTANCE$", "a", graphite::query::metric, cache}; diff --git a/tests/broker/graphite/stream.cc b/tests/broker/graphite/stream.cc index 5b09872e8a4..2ea70fa0564 100644 --- a/tests/broker/graphite/stream.cc +++ b/tests/broker/graphite/stream.cc @@ -20,10 +20,12 @@ #include "com/centreon/broker/graphite/stream.hh" #include #include +#include "com/centreon/exceptions/msg_fmt.hh" #include "com/centreon/broker/exceptions/msg.hh" #include "com/centreon/broker/logging/manager.hh" #include "../test_server.hh" +using namespace com::centreon::exceptions; using namespace com::centreon::broker; class graphiteStream : public testing::Test { @@ -46,22 +48,47 @@ class graphiteStream : public testing::Test { TEST_F(graphiteStream, BadPort) { std::shared_ptr cache; - ASSERT_THROW(graphite::stream st("metric_name", "status_name", "a", "user", "pass", "localhost", 4243, 3, cache), exceptions::msg); + ASSERT_THROW(graphite::stream st("metric_name", + "status_name", + "a", + "user", + "pass", + "localhost", + 4243, + 3, + cache), + msg_fmt); } TEST_F(graphiteStream, Read) { std::shared_ptr cache; std::shared_ptr data; - graphite::stream st("metric_name", "status_name", "a", "user", "pass", "localhost", 4242, 3, cache); + graphite::stream st("metric_name", + "status_name", + "a", + "user", + "pass", + "localhost", + 4242, + 3, + cache); ASSERT_THROW(st.read(data, -1), exceptions::msg); } TEST_F(graphiteStream, Write) { std::shared_ptr cache; - storage::metric *m1, *m2, *m3; + storage::metric* m1, *m2, *m3; std::shared_ptr data; - graphite::stream st("metric_name", "status_name", "a", "user", "pass", "localhost", 4242, 3, cache); + graphite::stream st("metric_name", + "status_name", + "a", + "user", + "pass", + "localhost", + 4242, + 3, + cache); m1 = new storage::metric; m2 = new storage::metric; @@ -113,9 +140,17 @@ TEST_F(graphiteStream, Write) { TEST_F(graphiteStream, Flush) { std::shared_ptr cache; - storage::metric *m1, *m2, *m3; + storage::metric* m1, *m2, *m3; std::shared_ptr data; - graphite::stream st("metric_name", "status_name", "a", "user", "pass", "localhost", 4242, 9, cache); + graphite::stream st("metric_name", + "status_name", + "a", + "user", + "pass", + "localhost", + 4242, + 9, + cache); m1 = new storage::metric; m2 = new storage::metric; @@ -187,10 +222,18 @@ TEST_F(graphiteStream, NullData) { TEST_F(graphiteStream, FlushStatusOK) { std::shared_ptr cache; - storage::status *s1, *s2, *s3; + storage::status* s1, *s2, *s3; std::shared_ptr data; - graphite::stream st("metric_name", "status_name", "a", "user", "pass", "localhost", 4242, 9, cache); + graphite::stream st("metric_name", + "status_name", + "a", + "user", + "pass", + "localhost", + 4242, + 9, + cache); s1 = new storage::status; s2 = new storage::status; @@ -245,7 +288,15 @@ TEST_F(graphiteStream, StatsAndConnector) { storage::metric m1, m2, m3; std::shared_ptr data; graphite::connector con; - con.connect_to("metric_name", "status_name", "a", "user", "pass", "localhost", 4242, 3, cache); + con.connect_to("metric_name", + "status_name", + "a", + "user", + "pass", + "localhost", + 4242, + 3, + cache); json11::Json::object obj; con.open()->statistics(obj);