ARTEMIS-4675 Add replication status metrics

This commit is contained in:
Alvin Kwekel 2024-03-06 17:25:15 +01:00 committed by Justin Bertram
parent d3e5b70d90
commit b9c919821b
No known key found for this signature in database
GPG Key ID: F41830B875BB8633
3 changed files with 8 additions and 2 deletions

View File

@ -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();
/**

View File

@ -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);
});
}
}

View File

@ -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";
}