dsmiley commented on code in PR #3636:
URL: https://github.com/apache/solr/pull/3636#discussion_r2331898942


##########
solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java:
##########
@@ -163,24 +163,59 @@ 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);
+    Attributes attrsWithCategory =
+        Attributes.builder().putAll(attributes).put("category", 
getCategory().toString()).build();
     // Metrics
-    numErrors = this.solrMetricsContext.meter("errors", 
getCategory().toString(), scope);
-    requests = this.solrMetricsContext.counter("requests", 
getCategory().toString(), scope);
+    numErrors =
+        new AttributedLongCounter(
+            this.solrMetricsContext.longCounter(
+                "solr_core_authentication_plugin_errors", "Count of errors 
during authentication"),
+            attrsWithCategory);
+    requests =
+        new AttributedLongCounter(
+            this.solrMetricsContext.longCounter(
+                "solr_core_authentication_plugin_requests", "Count of requests 
for authentication"),
+            attrsWithCategory);
     numAuthenticated =
-        this.solrMetricsContext.counter("authenticated", 
getCategory().toString(), scope);
+        new AttributedLongCounter(
+            this.solrMetricsContext.longCounter(
+                "solr_core_authentication_plugin_num_authenticated",
+                "Count of successful authentication requests"),
+            attrsWithCategory);
     numPassThrough =
-        this.solrMetricsContext.counter("passThrough", 
getCategory().toString(), scope);
+        new AttributedLongCounter(
+            this.solrMetricsContext.longCounter(
+                "solr_core_authentication_plugin_num_pass_through",
+                "Count of skipped authentication requests"),
+            attrsWithCategory);
     numWrongCredentials =
-        this.solrMetricsContext.counter("failWrongCredentials", 
getCategory().toString(), scope);
+        new AttributedLongCounter(
+            this.solrMetricsContext.longCounter(
+                "solr_core_authentication_plugin_fail_wrong_credentials",
+                "Count of authentication failures due to incorrect 
credentials"),
+            attrsWithCategory);
     numMissingCredentials =
-        this.solrMetricsContext.counter("failMissingCredentials", 
getCategory().toString(), scope);
-    requestTimes = this.solrMetricsContext.timer("requestTimes", 
getCategory().toString(), scope);
-    totalTime = this.solrMetricsContext.counter("totalTime", 
getCategory().toString(), scope);
+        new AttributedLongCounter(
+            this.solrMetricsContext.longCounter(
+                "solr_core_authentication_plugin_fail_missing_credentials",
+                "Count of authentication failures due to missing credentials"),
+            attrsWithCategory);
+    requestTimes =
+        new AttributedLongTimer(
+            this.solrMetricsContext.longHistogram(
+                "solr_core_authentication_plugin_request_times",
+                "Distribution of authentication request durations"),
+            attrsWithCategory);
+    totalTime =

Review Comment:
   is this redundant with requestTimes?



##########
solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java:
##########
@@ -163,24 +163,59 @@ 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);
+    Attributes attrsWithCategory =
+        Attributes.builder().putAll(attributes).put("category", 
getCategory().toString()).build();
     // Metrics
-    numErrors = this.solrMetricsContext.meter("errors", 
getCategory().toString(), scope);
-    requests = this.solrMetricsContext.counter("requests", 
getCategory().toString(), scope);
+    numErrors =

Review Comment:
   in other places, we've used a consistent metric name and used a "type" 
attribute to differentiate what we're counting.  Maybe we should do similar 
here?  I don't have a strong opinion.  I think at a minimum we should do that 
for error type differentiation.



##########
solr/core/src/java/org/apache/solr/util/RTimer.java:
##########
@@ -44,6 +45,11 @@ protected interface TimerImpl {
 
   private static class NanoTimeTimerImpl implements TimerImpl {
     private long start;
+    private final TimeUnit timeUnit;

Review Comment:
   nit: it's typical to put final/constant first; basically anything 
constructor initialized



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to