CASSANDRA-14366: Add prepared statement cache stats to nodetool info - #4969
Open
arvindKandpal-ksolves wants to merge 6 commits into
Open
CASSANDRA-14366: Add prepared statement cache stats to nodetool info#4969arvindKandpal-ksolves wants to merge 6 commits into
arvindKandpal-ksolves wants to merge 6 commits into
Conversation
Assisted-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
smiklosovic
reviewed
Jul 28, 2026
Contributor
Author
|
Hi @smiklosovic , I have refactored the method to fetch the metrics dynamically and removed the hardcoded names. Please take a look. |
smiklosovic
reviewed
Jul 30, 2026
| try | ||
| { | ||
| out.printf("%-23s: entries %d, size %s, capacity %s, %d executions, %d evictions%n", | ||
| "Prepared Stmt Cache", |
Contributor
There was a problem hiding this comment.
@arvindKandpal-ksolves please change "Stmt" to "Statement" (use full form, not the shortcut). Apply across the whole patch.
Also please align these arguments under the first one of printf.
Contributor
Author
There was a problem hiding this comment.
I have updated these.
But not sure with the align , as my previous alignment look same as other part of code , but I have updated , Please review once.
Maxwell-Guo
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This PR adds prepared statement cache statistics to the
nodetool infocommand output, bringing it into alignment with other cache metrics (such as Key Cache, Row Cache, Counter Cache, and Chunk Cache).Key Implementation Details
CQLMetrics.java: AddedpreparedStatementsCacheCapacityas a new JMX Gauge (PreparedStatementsCacheCapacity) to expose the configured cache memory limit (QueryProcessor.PREPARED_STATEMENT_CACHE_SIZE_BYTES).NodeProbe.java: AddedgetCQLMetric(String metricName)helper method to fetch CQL metrics via JMX (JmxGaugeMBeanfor gauges,JmxCounterMBeanfor counters).Info.java: Updatednodetool infooutput to display prepared statement cache stats (entries, current size, capacity, executions, and evictions).InternalNodeProbe.java: Added@OverrideforgetCQLMetric()throwingUnsupportedOperationExceptionto maintain consistency with existing mock methods in distributed test framework.InfoTest.java: Added a unit test validating thatnodetool infocorrectly includes and formats thePrepared Stmt Cacheline.Assisted-by: Claude Sonnet 4.6 (1M context) noreply@anthropic.com
patch by Arvind Kandpal; reviewed by TBD for CASSANDRA-14366