[ISSUE #5511]Fix Proxy start up throw NullPointerException (#5514)

* [ISSUE #5511]Fix Proxy start up throw NullPointerException

* do not init exporter when disable

do not init exporter when disable

* remove unused import

remove unused import

Co-authored-by: lizhimins <707364882@qq.com>
This commit is contained in:
mxsm
2022-11-14 17:38:07 +08:00
committed by GitHub
parent f55e6bace3
commit 14cff19f15
3 changed files with 5 additions and 1 deletions
@@ -516,4 +516,5 @@ public class BrokerMetricsManager {
prometheusHttpServer.shutdown();
}
}
}
@@ -134,7 +134,7 @@ public class ProxyStartup {
}
private static Options buildCommandlineOptions() {
Options options = ServerUtil.buildCommandlineOptions(new Options());
Options options = ServerUtil.buildCommandlineOptions(new Options());
Option opt = new Option("bc", "brokerConfigPath", true, "Broker config file path for local mode");
opt.setRequired(false);
@@ -69,6 +69,9 @@ public class ProxyMetricsManager implements StartAndShutdown {
public static ObservableLongGauge proxyUp = null;
public static void initLocalMode(BrokerMetricsManager brokerMetricsManager, ProxyConfig proxyConfig) {
if (proxyConfig.getMetricsExporterType() == BrokerConfig.MetricsExporterType.DISABLE) {
return;
}
ProxyMetricsManager.proxyConfig = proxyConfig;
LABEL_MAP.put(LABEL_NODE_TYPE, NODE_TYPE_PROXY);
LABEL_MAP.put(LABEL_CLUSTER_NAME, proxyConfig.getProxyClusterName());