wrunderwood commented on a change in pull request #96: URL: https://github.com/apache/solr/pull/96#discussion_r643423811
########## File path: solr/core/src/java/org/apache/solr/util/circuitbreaker/CPUCircuitBreaker.java ########## @@ -110,6 +113,27 @@ public double getCpuUsageThreshold() { } protected double calculateLiveCPUUsage() { - return operatingSystemMXBean.getSystemLoadAverage(); + Metric metric = this.core + .getCoreContainer() + .getMetricManager() + .registry("solr.jvm") + .getMetrics() + .get("os.systemCpuLoad"); + + if (metric == null) { + return -1.0; + } + + if (metric instanceof Gauge) { + @SuppressWarnings({"rawtypes"}) + Gauge gauge = (Gauge) metric; + // unwrap if needed + if (gauge instanceof SolrMetricManager.GaugeWrapper) { + gauge = ((SolrMetricManager.GaugeWrapper) gauge).getGauge(); + } + return ((Double) gauge.getValue()).doubleValue(); + } + + return -1.0; // Unable to unpack metric Review comment: There is a warning, see the documentation for details. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org