This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 667904c6a66 [Enhancement]Added a metric for geo replication for 
tracking replicated subscriptions snapshot timeouts (#22381)
667904c6a66 is described below

commit 667904c6a6631381dc5f4e716278c876a3f3fb83
Author: maheshnikam <[email protected]>
AuthorDate: Thu Oct 10 19:32:42 2024 +0530

    [Enhancement]Added a metric for geo replication for tracking replicated 
subscriptions snapshot timeouts (#22381)
    
    Co-authored-by: Lari Hotari <[email protected]>
---
 .../service/persistent/ReplicatedSubscriptionsController.java  | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/ReplicatedSubscriptionsController.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/ReplicatedSubscriptionsController.java
index f56cf9de66b..4fb0022194a 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/ReplicatedSubscriptionsController.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/ReplicatedSubscriptionsController.java
@@ -20,6 +20,7 @@ package org.apache.pulsar.broker.service.persistent;
 
 import static 
org.apache.pulsar.common.util.Runnables.catchingAndLoggingThrowables;
 import io.netty.buffer.ByteBuf;
+import io.prometheus.client.Counter;
 import io.prometheus.client.Gauge;
 import java.io.IOException;
 import java.time.Clock;
@@ -80,6 +81,14 @@ public class ReplicatedSubscriptionsController implements 
AutoCloseable, Topic.P
                     "Counter of currently pending snapshots")
             .register();
 
+    // timeouts use SnapshotOperationResult.TIMEOUT.attributes on the same 
metric
+    @PulsarDeprecatedMetric(
+            newMetricName = 
OpenTelemetryReplicatedSubscriptionStats.SNAPSHOT_OPERATION_COUNT_METRIC_NAME)
+    @Deprecated
+    private static final Counter timedoutSnapshotsMetric = Counter
+            .build().name("pulsar_replicated_subscriptions_timedout_snapshots")
+            .help("Counter of timed out snapshots").register();
+
     private final OpenTelemetryReplicatedSubscriptionStats stats;
 
     public ReplicatedSubscriptionsController(PersistentTopic topic, String 
localCluster) {
@@ -263,6 +272,7 @@ public class ReplicatedSubscriptionsController implements 
AutoCloseable, Topic.P
                 }
 
                 pendingSnapshotsMetric.dec();
+                timedoutSnapshotsMetric.inc();
                 var latencyMillis = entry.getValue().getDurationMillis();
                 stats.recordSnapshotTimedOut(latencyMillis);
                 it.remove();

Reply via email to