-
Notifications
You must be signed in to change notification settings - Fork 21
CNDB-7197: Added SAI_INDEX_METRICS_ENABLED to be able to enable/disable IndexMetrics #2025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Checklist before you submit for review
|
if (indexContext.getIndexMetrics() != null) | ||
indexContext.getIndexMetrics().segmentFlushErrors.inc(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a bunch of (probably harmless) dereferences like this one, and no external clue about IndexContext#getIndexMetrics
being nullable. I think we could do that method return an Optional
:
public Optional<IndexMetrics> getIndexMetrics()
{
return Optional.ofNullable(indexMetrics);
}
and then use it this way:
if (indexContext.getIndexMetrics() != null) | |
indexContext.getIndexMetrics().segmentFlushErrors.inc(); | |
indexContext.getIndexMetrics().ifPresent(m -> m.segmentFlushErrors.inc()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you are totally right. I was thinking about that and then forgot to fix it :( Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
} | ||
} | ||
|
||
private void assertMetricDoesNotExist(ObjectName name, String metricName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use the inherited SAITester#assertMetricDoesNotExist
. And since we have that method there, maybe we could move assertMetricExists
to SAITester
too?
CI finished ok, but Sonar complained about a missing test (one of the metrics never had a test, but because now we touched the code...), so I added that, removed a few imports I saw we don't need, and fixed one more warning from Sonar. That should be a wrap. @adelapena , @pkolaczk , please check the latest changes that you agree with everything. In the meantime I will update and run CI for the other PR. |
|
❌ Build ds-cassandra-pr-gate/PR-2025 rejected by Butler2 regressions found Found 2 new test failures
No known test failures found |
|
What is the issue
...
We want to be able to enable/disable IndexMetrics
What does this PR fix and why was it fixed
...
We add a flag to be able to do that -
SAI_INDEX_METRICS_ENABLED("cassandra.sai.metrics.index.enabled", "true")
Also, added some simple unit tests to test the new parameter.