Add Cassandra compaction progress metrics via JMX handler#2912
Open
jkoronaAtCisco wants to merge 5 commits into
Open
Add Cassandra compaction progress metrics via JMX handler#2912jkoronaAtCisco wants to merge 5 commits into
jkoronaAtCisco wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Cassandra compaction byte-progress metrics to the JMX scraper via a new code-based handler, and wires it into the Cassandra target system configuration and tests.
Changes:
- Introduces
CassandraCompactionProgressHandleremittingcassandra.compaction.progress.bytes/.totalgrouped bytaskType,keyspace,columnfamily. - Registers the handler via Java SPI and Cassandra YAML, and adds unit + integration test coverage.
- Adds an integration-test lifecycle hook to trigger long-running compactions after the scraper starts.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| jmx-scraper/src/main/java/io/opentelemetry/contrib/jmxscraper/handler/CassandraCompactionProgressHandler.java | New handler that queries Cassandra CompactionManager and emits progress gauges. |
| jmx-scraper/src/main/resources/META-INF/services/io.opentelemetry.instrumentation.jmx.internal.ExperimentalJmxMetricHandler | Registers the new handler via ServiceLoader. |
| jmx-scraper/src/main/resources/cassandra.yaml | Enables the handler for the Cassandra target system. |
| jmx-scraper/src/test/java/io/opentelemetry/contrib/jmxscraper/handler/CassandraCompactionProgressHandlerTest.java | Adds unit tests for grouping/parsing/skipping behavior. |
| jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/TargetSystemIntegrationTest.java | Adds an afterScraperStarted hook to support target-side actions post-start. |
| jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/CassandraIntegrationTest.java | Seeds data + triggers compaction to validate new progress metrics in integration tests. |
| jmx-scraper/build.gradle.kts | Adds Mockito dependency for new unit tests. |
| dependencyManagement/build.gradle.kts | Updates instrumentation version to a SNAPSHOT. |
| CHANGELOG.md | Documents the new compaction progress metrics. |
| } | ||
|
|
||
| val otelInstrumentationVersion = "2.28.1-alpha" | ||
| val otelInstrumentationVersion = "2.29.0-alpha-SNAPSHOT" |
Author
There was a problem hiding this comment.
As mentioned in PR description, stable release is not released yet. Will updated it asap.
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.
Description:
Adds two new Cassandra gauges to the JMX scraper:
cassandra.compaction.progress.bytes— bytes completed for in-flight compactionscassandra.compaction.progress.total— total bytes for in-flight compactionsBoth metrics carry
taskType,keyspace, andcolumnfamilyattributes and are grouped by that composite key. Only compactions measured in bytes are reported. Values are summed across parallel compaction tasks sharing the same key.Implemented as a code-based
ExperimentalJmxMetricHandler(SPI introduced in opentelemetry-java-instrumentation 2.29.0) because theCompactionsMBean attribute requires iteration, grouping, and BigInteger string parsing — none of which can be expressed in declarative YAML rules.Testing:
Unit tests added to cover new
CassandraCompactionProgressHandler.The Cassandra integration test was refactored to reliably produce visible compaction activity: data seeding now happens before the scraper starts, and compaction is triggered only after the scraper is running, eliminating a race condition in the original approach.
Notes: