This commit is contained in:
Alexey Vasiliev 2016-01-21 12:27:29 +03:00
commit 0f89a6aab7
2 changed files with 5 additions and 7 deletions

View File

@ -33,7 +33,7 @@ public:
/// Для облачных демонов удобней использовать
/// путь вида prefix.environment.layer.daemon_name.metrica
static const std::string & getPerLayerPath(const std::string & prefix = "one_min");
static std::string getPerLayerPath(const std::string & prefix = "one_min");
/// возвращает путь root_path.server_name
static std::string getPerServerPath(const std::string & server_name, const std::string & root_path = "one_min");

View File

@ -31,7 +31,7 @@ GraphiteWriter::GraphiteWriter(const std::string & config_name, const std::strin
root_path += "." + sub_path;
}
static std::string getPerLayerPathImpl(const std::string prefix)
std::string getPostfix()
{
/// Угадываем имя среды по имени машинки
/// машинки имеют имена вида example01dt.yandex.ru
@ -41,8 +41,6 @@ static std::string getPerLayerPathImpl(const std::string prefix)
std::stringstream path_full;
path_full << prefix << ".";
std::string hostname = Poco::Net::DNS::hostName();
hostname = hostname.substr(0, hostname.find('.'));
@ -72,10 +70,10 @@ static std::string getPerLayerPathImpl(const std::string prefix)
return path_full.str();
}
const std::string & GraphiteWriter::getPerLayerPath(const std::string & prefix)
std::string GraphiteWriter::getPerLayerPath(const std::string & prefix)
{
static std::string path = getPerLayerPathImpl(prefix); /// thread-safe statics.
return path;
const std::string static postfix = getPostfix();
return prefix + "." + postfix;
}
std::string GraphiteWriter::getPerServerPath(const std::string & server_name, const std::string & root_path)