Remove metric config parsing

pull/1124/head
Jason Rhinelander 4 years ago
parent 54186c4a89
commit 74d4afad51

@ -339,36 +339,6 @@ namespace llarp
}
}
void
MetricsConfig::fromSection(string_view key, string_view val)
{
if(key == "enable-metrics")
{
disableMetrics = IsFalseValue(val);
}
else if(key == "disable-metrics")
{
disableMetrics = IsTrueValue(val);
}
else if(key == "disable-metrics-log")
{
disableMetricLogs = IsTrueValue(val);
}
else if(key == "json-metrics-path")
{
jsonMetricsPath = val;
}
else if(key == "metric-tank-host")
{
metricTankHost = val;
}
else
{
// consume everything else as a metric tag
metricTags[key] = val;
}
}
void
ApiConfig::fromSection(string_view key, string_view val)
{
@ -533,7 +503,6 @@ namespace llarp
links = find_section< LinksConfig >(parser, "bind");
services = find_section< ServicesConfig >(parser, "services");
system = find_section< SystemConfig >(parser, "system");
metrics = find_section< MetricsConfig >(parser, "metrics");
api = find_section< ApiConfig >(parser, "api");
lokid = find_section< LokidConfig >(parser, "lokid");
bootstrap = find_section< BootstrapConfig >(parser, "bootstrap");
@ -669,10 +638,6 @@ llarp_generic_ensure_config(std::ofstream &f, std::string basepath,
f << "# uncomment for syslog logging\n";
f << "#type=syslog\n";
// metrics
f << "[metrics]\n";
f << "json-metrics-path=" << basepath << "metrics.json\n";
f << "\n\n";
f << "# admin api\n";

@ -186,18 +186,6 @@ namespace llarp
fromSection(string_view key, string_view val);
};
struct MetricsConfig
{
bool disableMetrics = true;
bool disableMetricLogs = true;
fs::path jsonMetricsPath;
std::string metricTankHost;
std::map< std::string, std::string > metricTags;
void
fromSection(string_view key, string_view val);
};
class ApiConfig
{
private:
@ -258,7 +246,6 @@ namespace llarp
LinksConfig links;
ServicesConfig services;
SystemConfig system;
MetricsConfig metrics;
ApiConfig api;
LokidConfig lokid;
BootstrapConfig bootstrap;

@ -38,8 +38,6 @@ level=info
#file=/path/to/logfile
# uncomment for syslog logging
#type=syslog
[metrics]
json-metrics-path=/home/lokinet/1/metrics.json
# admin api (disabled by default)
[api]
@ -84,8 +82,6 @@ eth0=5501
ifname=cluster-1
ifaddr=10.101.0.1/16
[metrics]
metric-tank-host=52.80.56.123:2003
)";
Config config;
@ -98,8 +94,6 @@ metric-tank-host=52.80.56.123:2003
UnorderedElementsAre(kv("ifname", "cluster-1"),
kv("ifaddr", "10.101.0.1/16")));
}
ASSERT_TRUE(config.metrics.disableMetricLogs);
ASSERT_TRUE(config.metrics.disableMetrics);
{
using kv = LinksConfig::Links::value_type;

Loading…
Cancel
Save