Skip to content

Introduce a MetricsFactory which can be used to produce metrics objects at the Table and Keyspace level, and which is customizable#2272

Open
scottfines wants to merge 12 commits intomainfrom
c17059
Open

Introduce a MetricsFactory which can be used to produce metrics objects at the Table and Keyspace level, and which is customizable#2272
scottfines wants to merge 12 commits intomainfrom
c17059

Conversation

@scottfines
Copy link
Copy Markdown

This ensures that no JMX or other metrics are created for Keyspace and ColumnFamilyStore objects that are opened without loading SSTables.

Some highlights (and possible reasons why this solution won't work):

  • This uses the openSSTables flag to determine whether or not metrics are collected. The reasoning being that "If the SSTables are loaded, then we probably don't care about the metrics either". However, that may not be true! In that case, we may want to modify this to include a distinct "metrics" flag, or explicitly pass in a metrics factory, or similar.
  • The trivial approach(replace KeyspaceMetrics with null) is a less disruptive change on the surface, but other code throughout the system appears to implicitly depend on the metrics object not being null. Enough of that existed throughout the codebase that the choice became "guarantee that every possible usage allows for null entries" or "risk a NPE if I am wrong about whether or not this case will always be used correctly". I opted for the slightly more disruptive approach of creating a subclass that doesn't register metrics. If you are a person with more knowledge of the C* codebase and has more confident that the nullity solution will work, then I'm open to being convinced. But this approach seemed to be safer overall.

@scottfines scottfines marked this pull request as ready for review March 12, 2026 20:53
@github-actions
Copy link
Copy Markdown

Checklist before you submit for review

  • This PR adheres to the Definition of Done
  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@scottfines scottfines marked this pull request as draft March 13, 2026 16:45
@scottfines scottfines force-pushed the c17059 branch 2 times, most recently from 17cfece to 8cf72eb Compare March 19, 2026 20:00
@scottfines scottfines marked this pull request as ready for review March 19, 2026 20:02
@scottfines scottfines changed the title Create no-op metrics for Keyspace and ColumnFamilyStore when loadSSTables is false. Disable Keyspace and ColumnFamily metrics in the RegionService Mar 19, 2026
@scottfines scottfines changed the title Disable Keyspace and ColumnFamily metrics in the RegionService Disable Keyspace and ColumnFamily metrics when specified by System property Mar 20, 2026
@scottfines scottfines marked this pull request as draft March 20, 2026 14:29
@scottfines scottfines changed the title Disable Keyspace and ColumnFamily metrics when specified by System property Introduce a MetricsFactory which can be used to produce metrics objects at the Table and Keyspace level, and which is customizable Apr 13, 2026
@scottfines scottfines marked this pull request as ready for review April 13, 2026 14:39
@sonarqubecloud
Copy link
Copy Markdown

@cassci-bot
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants