mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
deduplicatord: supported layers [#MOBMET-3538]
This commit is contained in:
parent
5ad60a21ef
commit
8aebb9396f
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
#include <Poco/Net/StreamSocket.h>
|
||||
@ -34,7 +35,9 @@ public:
|
||||
|
||||
/// Для облачных демонов удобней использовать
|
||||
/// путь вида prefix.environment.layer.daemon_name.metrica
|
||||
static std::string getPerLayerPath(const std::string & prefix = "one_min");
|
||||
static std::string getPerLayerPath(
|
||||
const std::string & prefix = "one_min",
|
||||
const boost::optional<std::size_t> layer = {});
|
||||
|
||||
/// возвращает путь root_path.server_name
|
||||
static std::string getPerServerPath(const std::string & server_name, const std::string & root_path = "one_min");
|
||||
|
@ -49,7 +49,7 @@ GraphiteWriter::GraphiteWriter(const std::string & config_name, const std::strin
|
||||
root_path += "." + sub_path;
|
||||
}
|
||||
|
||||
std::string getPostfix()
|
||||
std::string getPostfix(const boost::optional<std::size_t> layer)
|
||||
{
|
||||
/// Угадываем имя среды по имени машинки
|
||||
/// машинки имеют имена вида example01dt.yandex.ru
|
||||
@ -73,7 +73,9 @@ std::string getPostfix()
|
||||
|
||||
const BaseDaemon & daemon = BaseDaemon::instance();
|
||||
|
||||
if (daemon.getLayer())
|
||||
if (layer)
|
||||
path_full << "layer" << std::setfill('0') << std::setw(3) << *layer << ".";
|
||||
else if (daemon.getLayer())
|
||||
path_full << "layer" << std::setfill('0') << std::setw(3) << *daemon.getLayer() << ".";
|
||||
|
||||
/// Когда несколько демонов запускается на одной машине
|
||||
@ -88,9 +90,11 @@ std::string getPostfix()
|
||||
return path_full.str();
|
||||
}
|
||||
|
||||
std::string GraphiteWriter::getPerLayerPath(const std::string & prefix)
|
||||
std::string GraphiteWriter::getPerLayerPath(
|
||||
const std::string & prefix,
|
||||
const boost::optional<std::size_t> layer)
|
||||
{
|
||||
const std::string static postfix = getPostfix();
|
||||
const std::string static postfix = getPostfix(layer);
|
||||
return prefix + "." + postfix;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user