summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/Metric/Metric.cpp21
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]);
}