Skip to content

Commit

Permalink
This closes #3054
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Apr 2, 2020
2 parents a2696cd + 505b3b0 commit aefd730
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Expand Up @@ -136,6 +136,10 @@ public FileStoreMonitor setMaxUsage(double maxUsage) {
}

public static double calculateUsage(long usableSpace, long totalSpace) {

if (totalSpace == 0) {
return 0.0;
}
return 1.0 - (double) usableSpace / (double) totalSpace;
}

Expand Down
Expand Up @@ -2996,11 +2996,18 @@ private void registerMeters() {
builder.register(BrokerMetricNames.CONNECTION_COUNT, this, metrics -> Double.valueOf(getConnectionCount()), ActiveMQServerControl.CONNECTION_COUNT_DESCRIPTION);
builder.register(BrokerMetricNames.TOTAL_CONNECTION_COUNT, this, metrics -> Double.valueOf(getTotalConnectionCount()), ActiveMQServerControl.TOTAL_CONNECTION_COUNT_DESCRIPTION);
builder.register(BrokerMetricNames.ADDRESS_MEMORY_USAGE, this, metrics -> Double.valueOf(getPagingManager().getGlobalSize()), ActiveMQServerControl.ADDRESS_MEMORY_USAGE_DESCRIPTION);
builder.register(BrokerMetricNames.DISK_STORE_USAGE, this, metrics -> Double.valueOf(getPagingManager().getDiskTotalSpace() - getPagingManager().getDiskUsableSpace()), ActiveMQServerControl.DISK_STORE_USAGE_DESCRIPTION);
builder.register(BrokerMetricNames.DISK_STORE_USAGE, this, metrics -> Double.valueOf(calculateDiskStoreUsage()), ActiveMQServerControl.DISK_STORE_USAGE_DESCRIPTION);
});
}
}

private double calculateDiskStoreUsage() {
long usableSpace = getPagingManager().getDiskUsableSpace();
long totalSpace = getPagingManager().getDiskTotalSpace();

return FileStoreMonitor.calculateUsage(usableSpace, totalSpace);
}

private void unregisterMeters() {
MetricsManager metricsManager = this.metricsManager; // volatile load
if (metricsManager != null) {
Expand Down
Expand Up @@ -116,13 +116,14 @@ public int hashCode() {

assertThat(artemisMetrics, containsInAnyOrder(
// artemis.(un)routed.message.count is present twice, because of activemq.notifications address
new Metric("artemis.address.memory.usage", "Memory used by all the addresses on broker for in-memory messages", 0.0),
new Metric("artemis.address.memory.usage", "Bytes used by all the addresses on broker for in-memory messages", 0.0),
new Metric("artemis.connection.count", "Number of clients connected to this server", 1.0),
new Metric("artemis.consumer.count", "number of consumers consuming messages from this queue", 0.0),
new Metric("artemis.delivering.durable.message.count", "number of durable messages that this queue is currently delivering to its consumers", 0.0),
new Metric("artemis.delivering.durable.persistent.size", "persistent size of durable messages that this queue is currently delivering to its consumers", 0.0),
new Metric("artemis.delivering.message.count", "number of messages that this queue is currently delivering to its consumers", 0.0),
new Metric("artemis.delivering.persistent_size", "persistent size of messages that this queue is currently delivering to its consumers", 0.0),
new Metric("artemis.disk.store.usage", "Memory used by the disk store", 0.0),
new Metric("artemis.durable.message.count", "number of durable messages currently in this queue (includes scheduled, paged, and in-delivery messages)", 0.0),
new Metric("artemis.durable.persistent.size", "persistent size of durable messages currently in this queue (includes scheduled, paged, and in-delivery messages)", 0.0),
new Metric("artemis.message.count", "number of messages currently in this queue (includes scheduled, paged, and in-delivery messages)", 0.0),
Expand Down

0 comments on commit aefd730

Please sign in to comment.