diff --git a/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java b/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java index 1da6ed0d1a..c234d791fb 100644 --- a/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java +++ b/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java @@ -20,6 +20,7 @@ import com.codahale.metrics.Gauge; import com.codahale.metrics.Timer; +import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.commitlog.AbstractCommitLogService; import org.apache.cassandra.db.commitlog.CommitLogSegmentManager; @@ -38,6 +39,8 @@ public class CommitLogMetrics public Gauge pendingTasks; /** Current size used by all the commit log segments */ public Gauge totalCommitLogSize; + /** Max total size for all commit log segments, as set in cassandra.yaml */ + public Gauge maxTotalCommitLogSizeBytes; /** Time spent waiting for a CLS to be allocated - under normal conditions this should be zero */ public final Timer waitingOnSegmentAllocation; /** The time spent waiting on CL sync; for Periodic this is only occurs when the sync is lagging its sync interval */ @@ -72,5 +75,12 @@ public Long getValue() return allocator.onDiskSize(); } }); + maxTotalCommitLogSizeBytes = Metrics.register(factory.createMetricName("MaxTotalCommitLogSizeBytes"), new Gauge() + { + public Long getValue() + { + return DatabaseDescriptor.getTotalCommitlogSpaceInMB() * 1024 * 1024; + } + }); } }