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


##########
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);

Review Comment:
   Merged, using `type` label to distinguish different failure types.



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