You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/06 16:58:15 UTC

[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #18907: Fixed the error of null value in contextManager when collecting metric data

RaigorJiang commented on code in PR #18907:
URL: https://github.com/apache/shardingsphere/pull/18907#discussion_r915066768


##########
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:
   Why was the judgment of `!stateContext.isPresent()` removed?



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org