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

jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new b9c919821b ARTEMIS-4675 Add replication status metrics
     new 9ea27c15a2 This closes #4844
b9c919821b is described below

commit b9c919821beea8ca501b7cc30d61866332590629
Author: Alvin Kwekel <am.kwe...@minvws.nl>
AuthorDate: Wed Mar 6 17:25:15 2024 +0100

    ARTEMIS-4675 Add replication status metrics
---
 .../activemq/artemis/api/core/management/ActiveMQServerControl.java | 6 ++++--
 .../artemis/core/server/management/impl/ManagementServiceImpl.java  | 2 ++
 .../activemq/artemis/core/server/metrics/BrokerMetricNames.java     | 2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
index 4d2cea380e..b8633e8c79 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
@@ -31,6 +31,8 @@ public interface ActiveMQServerControl {
    String ADDRESS_MEMORY_USAGE_DESCRIPTION = "Memory used by all the addresses 
on broker for in-memory messages";
    String ADDRESS_MEMORY_USAGE_PERCENTAGE_DESCRIPTION = "Memory used by all 
the addresses on broker as a percentage of the global-max-size";
    String DISK_STORE_USAGE_DESCRIPTION = "Fraction of total disk store used";
+   String REPLICA_SYNC_DESCRIPTION = "If the initial replication 
synchronization process is complete";
+   String IS_ACTIVE_DESCRIPTION = "If the server is active";
 
    /**
     * Returns this server's name.
@@ -48,7 +50,7 @@ public interface ActiveMQServerControl {
    String getVersion();
 
 
-   @Attribute(desc = "Server is active")
+   @Attribute(desc = IS_ACTIVE_DESCRIPTION)
    boolean isActive();
 
    /**
@@ -470,7 +472,7 @@ public interface ActiveMQServerControl {
     * Returns whether the initial replication synchronization process with the 
backup server is complete; applicable for
     * either the primary or backup server.
     */
-   @Attribute(desc = "Whether the initial replication synchronization process 
with the backup server is complete")
+   @Attribute(desc = REPLICA_SYNC_DESCRIPTION)
    boolean isReplicaSync();
 
    /**
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
index bd514e61f6..60d7a785cc 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
@@ -241,6 +241,8 @@ public class ManagementServiceImpl implements 
ManagementService {
             builder.build(BrokerMetricNames.ADDRESS_MEMORY_USAGE, 
messagingServer, metrics -> 
Double.valueOf(messagingServerControl.getAddressMemoryUsage()), 
ActiveMQServerControl.ADDRESS_MEMORY_USAGE_DESCRIPTION);
             builder.build(BrokerMetricNames.ADDRESS_MEMORY_USAGE_PERCENTAGE, 
messagingServer, metrics -> 
Double.valueOf(messagingServerControl.getAddressMemoryUsagePercentage()), 
ActiveMQServerControl.ADDRESS_MEMORY_USAGE_PERCENTAGE_DESCRIPTION);
             builder.build(BrokerMetricNames.DISK_STORE_USAGE, messagingServer, 
metrics -> Double.valueOf(messagingServer.getDiskStoreUsage()), 
ActiveMQServerControl.DISK_STORE_USAGE_DESCRIPTION);
+            builder.build(BrokerMetricNames.REPLICA_SYNC, messagingServer, 
metrics -> messagingServer.isReplicaSync() ? 1D : 0D, 
ActiveMQServerControl.REPLICA_SYNC_DESCRIPTION);
+            builder.build(BrokerMetricNames.ACTIVE, messagingServer, metrics 
-> messagingServer.isActive() ? 1D : 0D, 
ActiveMQServerControl.IS_ACTIVE_DESCRIPTION);
          });
       }
    }
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/metrics/BrokerMetricNames.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/metrics/BrokerMetricNames.java
index 44da0787ba..a31db9619e 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/metrics/BrokerMetricNames.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/metrics/BrokerMetricNames.java
@@ -23,4 +23,6 @@ public class BrokerMetricNames {
    public static final String ADDRESS_MEMORY_USAGE = "address.memory.usage";
    public static final String ADDRESS_MEMORY_USAGE_PERCENTAGE = 
"address.memory.usage.percentage";
    public static final String DISK_STORE_USAGE = "disk.store.usage";
+   public static final String REPLICA_SYNC = "replica.sync";
+   public static final String ACTIVE = "active";
 }

Reply via email to