Prompush Reporter: Adding Option to pass the apikeyfile (#2058)

* making changes

* remove unwanted print statements
This commit is contained in:
sahankj2000
2024-10-29 22:29:56 +05:30
committed by GitHub
parent 1ac12521eb
commit 152e5d0540
4 changed files with 35 additions and 9 deletions

View File

@@ -483,7 +483,7 @@ public class NBCLI implements Function<String[], Integer>, NBLabeledElement {
default:
throw new RuntimeException("Unable to parse '" + cfg + "', must be in <URI> or <URI>,ms form");
}
session.create().pushReporter(uri, intervalMs, NBLabels.forKV());
session.create().pushReporter(uri, intervalMs, NBLabels.forKV(), options.getPrompushApikeyfile());
});
for (final NBCLIOptions.LoggerConfigData histoLogger : options.getHistoLoggerConfigs()) {
session.create().histoLogger(sessionName, histoLogger.pattern, histoLogger.file, histoLogger.millis);

View File

@@ -118,6 +118,7 @@ public class NBCLIOptions {
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 PROMPUSH_API_KEYFILE = "--prompush-apikeyfile";
private static final String GRAPHITE_LOG_LEVEL = "--graphite-log-level";
private static final String REPORT_CSV_TO = "--report-csv-to";
private static final String REPORT_SUMMARY_TO = "--report-summary-to";
@@ -164,6 +165,7 @@ public class NBCLIOptions {
private boolean wantsBasicHelp;
private String reportGraphiteTo;
private String reportPromPushTo;
private String prompushApikeyfile;
private String reportCsvTo;
private String reportSqliteTo;
private int reportInterval = 10;
@@ -288,6 +290,10 @@ public class NBCLIOptions {
return this.wantsToCatResource != null && !this.wantsToCatResource.isEmpty();
}
public String getPrompushApikeyfile() {
return this.prompushApikeyfile;
}
public enum Mode {
ParseGlobalsOnly,
ParseAllOptions
@@ -414,6 +420,10 @@ public class NBCLIOptions {
arglist.removeFirst();
this.reportPromPushTo = arglist.removeFirst();
break;
case NBCLIOptions.PROMPUSH_API_KEYFILE:
arglist.removeFirst();
this.prompushApikeyfile = arglist.removeFirst();
break;
case NBCLIOptions.GRAPHITE_LOG_LEVEL:
arglist.removeFirst();
this.graphitelogLevel = arglist.removeFirst();