SOLR-18455: actually disable metrics on <metrics enabled="false"/> - #4902
Conversation
Co-authored-by: mkhludnev <807522+mkhludnev@users.noreply.github.com>
Co-authored-by: mkhludnev <807522+mkhludnev@users.noreply.github.com>
| assertU(adoc("id", "1000000", "field1_s", "foo")); | ||
| openNewSearcherAndWait(); | ||
|
|
||
| assertEventuallyReleased(replacedSearcher); |
There was a problem hiding this comment.
too heavy test. Put it into Nightly or drop?
There was a problem hiding this comment.
If a test take a while depending on the person environment, probably nightly makes sense if that is the case in this test.
There was a problem hiding this comment.
|
at least this patch let to disable metrics and it let me pass the benchmark for #4749 |
| public void testReplacedSearcherCanBeGarbageCollected() throws Exception { | ||
| WeakReference<SolrIndexSearcher> replacedSearcher = registerCurrentSearcherForGcCheck(); | ||
|
|
||
| assertU(adoc("id", "1000000", "field1_s", "foo")); |
There was a problem hiding this comment.
This doc needs to be deleted at the end of the test to avoid index pollution for other tests.
|
Running with metricsEnabled=false produces this exception: Edit: this looks like a pre-existing bug, it happens also on main. |
| } | ||
| }); | ||
| // size of the currently opened commit | ||
| solrMetricsContext.observableDoubleGauge( |
| assertU(adoc("id", "1000000", "field1_s", "foo")); | ||
| openNewSearcherAndWait(); | ||
|
|
||
| assertEventuallyReleased(replacedSearcher); |
There was a problem hiding this comment.
If a test take a while depending on the person environment, probably nightly makes sense if that is the case in this test.
| private Meter meter(String registry) { | ||
| if (!enabled) { | ||
| return OpenTelemetry.noop().getMeterProvider().get(OTEL_SCOPE_NAME); | ||
| } | ||
| return meterProvider(registry).get(OTEL_SCOPE_NAME); | ||
| } |
There was a problem hiding this comment.
I think this PR should be rescoped and titled to fixing this disabling of metrics.
There was a problem hiding this comment.
extracted to https://issues.apache.org/jira/browse/SOLR-18455
There was a problem hiding this comment.
I like the changes for this on disabling metrics. Can you change the title to SOLR-18455 and rip out the searcher changes? The other PR should be the actual fix for the leak.
|
it seems to cause the fail |
| previousMetricsEnabled = System.getProperty("metricsEnabled"); | ||
| System.setProperty("metricsEnabled", "false"); |
There was a problem hiding this comment.
why do this? Solr's test infrastructure ensures that each test suite (class) starts with the same set of system properties, thus making it impossible for one test suite to mess with system properties in a way affecting another test.
| return builder; | ||
| } | ||
|
|
||
| private Meter meter(String registry) { |
There was a problem hiding this comment.
why introduce this... couldn't you modify the meterProvider method here to do this enabled check and respond similarly?
https://issues.apache.org/jira/browse/SOLR-18455
Description
Please provide a short description of the changes you're making with this pull request.
Solution
Please provide a short description of the approach taken to implement your solution.
We appreciate transparent disclosure of significant AI Coding assistants usage.
Tests
Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.