diff options
author | skelUA <v.tkachenko.it@gmail.com> | 2025-07-19 23:14:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-19 22:14:42 +0200 |
commit | 7c4a5bc37ccc1f5f1567cf97c65fb04cd3be26ad (patch) | |
tree | a64e7e72daeeb94fc2059daafd8220f002286e83 /src/common/Metric/Metric.cpp | |
parent | 7ff30f5b30861a5eda40c866407211b08cecc02d (diff) |
fix(Core/Metrics): InfluxDB v1 config check #22358 (#22479)
Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
Diffstat (limited to 'src/common/Metric/Metric.cpp')
-rw-r--r-- | src/common/Metric/Metric.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp index c35fa30b6c..96e142faf4 100644 --- a/src/common/Metric/Metric.cpp +++ b/src/common/Metric/Metric.cpp @@ -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]); } |