diff --git a/libs/libdaemon/include/daemon/BaseDaemon.h b/libs/libdaemon/include/daemon/BaseDaemon.h index 250fa6b42c9..2a2c1b1f747 100644 --- a/libs/libdaemon/include/daemon/BaseDaemon.h +++ b/libs/libdaemon/include/daemon/BaseDaemon.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -124,6 +125,14 @@ public: writer->write(key_vals, timestamp, custom_root_path); } + template + void writeToGraphite(const GraphiteWriter::KeyValueVector & key_vals, const std::chrono::system_clock::time_point & current_time, const std::string & custom_root_path) + { + auto writer = getGraphiteWriter(); + if (writer) + writer->write(key_vals, std::chrono::system_clock::to_time_t(current_time), custom_root_path); + } + GraphiteWriter * getGraphiteWriter(const std::string & config_name = DEFAULT_GRAPHITE_CONFIG_NAME) { if (graphite_writers.count(config_name))