adamjq commented on code in PR #3516:
URL: https://github.com/apache/solr/pull/3516#discussion_r2308005645


##########
solr/core/src/java/org/apache/solr/util/stats/InstrumentedPoolingHttpClientConnectionManager.java:
##########
@@ -44,26 +43,36 @@ public SolrMetricsContext getSolrMetricsContext() {
     return solrMetricsContext;
   }
 
-  // TODO SOLR-17458: Migrate to Otel
   @Override
   public void initializeMetrics(
       SolrMetricsContext parentContext, Attributes attributes, String scope) {
     this.solrMetricsContext = parentContext.getChildContext(this);
-    solrMetricsContext.gauge(
-        () -> getTotalStats().getAvailable(),
-        true,
-        SolrMetricManager.mkName("availableConnections", scope));
+
+    var baseAttributes = attributes.toBuilder()
+      .put(CATEGORY_ATTR, SolrInfoBean.Category.HTTP.toString())
+      .build();
+
+    solrMetricsContext.observableLongGauge(
+            "solr_http_connection_pool_available_connections",
+            "The current number of available connections in the pool.",
+            (observableLongMeasurement ->
+                    
observableLongMeasurement.record(getTotalStats().getAvailable(), 
baseAttributes)));
     // this acquires a lock on the connection pool; remove if contention sucks
-    solrMetricsContext.gauge(
-        () -> getTotalStats().getLeased(),
-        true,
-        SolrMetricManager.mkName("leasedConnections", scope));
-    solrMetricsContext.gauge(
-        () -> getTotalStats().getMax(), true, 
SolrMetricManager.mkName("maxConnections", scope));
-    solrMetricsContext.gauge(
-        () -> getTotalStats().getPending(),
-        true,
-        SolrMetricManager.mkName("pendingConnections", scope));
+    solrMetricsContext.observableLongGauge(
+            "solr_http_connection_pool_leased_connections",
+            "The current number of leased connections from the pool.",
+            (observableLongMeasurement ->
+                    
observableLongMeasurement.record(getTotalStats().getLeased(), baseAttributes)));
+    solrMetricsContext.observableLongGauge(
+            "solr_http_connection_pool_max_connections",
+            "The maximum number of total connections in the pool.",
+            (observableLongMeasurement ->
+                    observableLongMeasurement.record(getTotalStats().getMax(), 
baseAttributes)));
+    solrMetricsContext.observableLongGauge(
+            "solr_http_connection_pool_pending_requests",
+            "The number of requests waiting for a connection from the pool.",
+            (observableLongMeasurement ->
+                    
observableLongMeasurement.record(getTotalStats().getPending(), 
baseAttributes)));

Review Comment:
   Good idea. I've updated that now



-- 
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: issues-unsubscr...@solr.apache.org

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

Reply via email to