allow to disable metrics logger

This commit is contained in:
Jonathan Shook
2023-09-09 00:12:28 -05:00
parent a64aa58fc6
commit 2a9507bcc1
2 changed files with 13 additions and 1 deletions

View File

@@ -418,7 +418,7 @@ public class NBCLI implements Function<String[], Integer>, NBLabeledElement {
if (null != reportGraphiteTo) reporters.addGraphite(reportGraphiteTo, options.wantsMetricsPrefix());
if (null != options.wantsReportCsvTo())
reporters.addCSVReporter(options.wantsReportCsvTo(), options.wantsMetricsPrefix());
reporters.addLogger();
if (options.wantsLoggedMetrics()) { reporters.addLogger(); }
reporters.start(10, options.getReportInterval());
}

View File

@@ -104,6 +104,8 @@ public class NBCLIOptions {
private static final String REPORT_INTERVAL = "--report-interval";
private static final String REPORT_GRAPHITE_TO = "--report-graphite-to";
private static final String ENABLE_LOGGED_METRICS = "--enable-logged-metrics";
private static final String DISABLE_LOGGED_METRICS = "--disable-logged-metrics";
private static final String REPORT_PROMPUSH_TO = "--report-prompush-to";
private static final String GRAPHITE_LOG_LEVEL = "--graphite-log-level";
private static final String REPORT_CSV_TO = "--report-csv-to";
@@ -197,7 +199,9 @@ public class NBCLIOptions {
private boolean wantsListCommands;
private boolean wantsListApps;
private boolean dedicatedVerificationLogger;
private boolean wantsConsoleMetrics =true;
public boolean wantsLoggedMetrics() { return this.wantsConsoleMetrics; }
public boolean isWantsListApps() {
return this.wantsListApps;
}
@@ -485,6 +489,14 @@ public class NBCLIOptions {
String addLabeldata = arglist.removeFirst();
addLabels(addLabeldata);
break;
case NBCLIOptions.ENABLE_LOGGED_METRICS:
arglist.removeFirst();
this.wantsConsoleMetrics =true;
break;
case NBCLIOptions.DISABLE_LOGGED_METRICS:
arglist.removeFirst();
this.wantsConsoleMetrics =false;
break;
default:
nonincludes.addLast(arglist.removeFirst());
}