jiangML commented on code in PR #18907:
URL: https://github.com/apache/shardingsphere/pull/18907#discussion_r915386512
##########
shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/ProxyInfoCollector.java:
##########
@@ -56,10 +56,10 @@ public List<MetricFamilySamples> collect() {
return Collections.emptyList();
}
Optional<GaugeMetricFamily> proxyInfo =
FACTORY.createGaugeMetricFamily(MetricIds.PROXY_INFO);
- Optional<StateContext> stateContext =
ProxyContext.getInstance().getStateContext();
- if (!proxyInfo.isPresent() || !stateContext.isPresent()) {
+ if (null == ProxyContext.getInstance().getContextManager() ||
!proxyInfo.isPresent()) {
Review Comment:
I thought that when the ContextManager is not empty, the stateContext will
definitely not be empty.
According to ProxyContext to obtain the internal logic of stateContext,
judgment should be added.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]