mlbiscoc commented on code in PR #3440:
URL: https://github.com/apache/solr/pull/3440#discussion_r2237801045


##########
solr/core/src/java/org/apache/solr/update/PeerSync.java:
##########
@@ -143,14 +143,28 @@ 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);
-    syncTime = solrMetricsContext.timer("time", scope, METRIC_SCOPE);
-    syncErrors = solrMetricsContext.counter("errors", scope, METRIC_SCOPE);
-    syncSkipped = solrMetricsContext.counter("skipped", scope, METRIC_SCOPE);
+    var baseAttributes =
+        attributes.toBuilder()
+            .put("category", SolrInfoBean.Category.REPLICATION.toString())
+            .build();
+    syncErrors =
+        new AttributedLongCounter(
+            solrMetricsContext.longCounter(
+                "solr_core_peer_sync_errors", "Total number of sync errors 
with peer"),
+            baseAttributes);
+    syncSkipped =
+        new AttributedLongCounter(
+            solrMetricsContext.longCounter(
+                "solr_core_peer_sync_skipped", "Total number of skipped syncs 
with peer"),
+            baseAttributes);
+    syncTime =
+        new AttributedLongTimer(
+            solrMetricsContext.longHistogram("solr_core_peer_sync_time", "Peer 
sync times", "ms"),
+            baseAttributes);

Review Comment:
   I believe most of the time peer sync is done with a leader majority of the 
time but in some cases like leader election the replicas do a [sync with each 
other](https://github.com/apache/solr/blob/6bb80bd72d5fa06035d10c157c27476fbb76188f/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java#L196)
 which probably triggers these. 



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