fix(Core/Metrics): InfluxDB v1 config check #22358 (#22479)

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
skelUA
2025-07-19 23:14:42 +03:00
committed by GitHub
parent 7ff30f5b30
commit 7c4a5bc37c

View File

@@ -107,18 +107,17 @@ void Metric::LoadFromConfigs()
}
std::vector<std::string_view> tokens = Acore::Tokenize(connectionInfo, ';', true);
if (tokens.size() != 2)
{
LOG_ERROR("metric", "Metric.InfluxDB.Connection specified with wrong format in configuration file.");
return;
}
_hostname.assign(tokens[0]);
_port.assign(tokens[1]);
_useV2 = sConfigMgr->GetOption<bool>("Metric.InfluxDB.v2", false);
if (_useV2)
{
if (tokens.size() != 2)
{
LOG_ERROR("metric", "Metric.InfluxDB.Connection specified with wrong format in configuration file. (hostname;port)");
return;
}
_hostname.assign(tokens[0]);
_port.assign(tokens[1]);
_org = sConfigMgr->GetOption<std::string>("Metric.InfluxDB.Org", "");
_bucket = sConfigMgr->GetOption<std::string>("Metric.InfluxDB.Bucket", "");
_token = sConfigMgr->GetOption<std::string>("Metric.InfluxDB.Token", "");
@@ -133,10 +132,12 @@ void Metric::LoadFromConfigs()
{
if (tokens.size() != 3)
{
LOG_ERROR("metric", "Metric.InfluxDB.Connection specified with wrong format in configuration file.");
LOG_ERROR("metric", "Metric.InfluxDB.Connection specified with wrong format in configuration file. (hostname;port;database)");
return;
}
_hostname.assign(tokens[0]);
_port.assign(tokens[1]);
_databaseName.assign(tokens[2]);
}