-
Notifications
You must be signed in to change notification settings - Fork 8
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
Make sure listener is started when query metrics enabled #74
Make sure listener is started when query metrics enabled #74
Conversation
Signed-off-by: Siddhant Deshmukh <[email protected]>
Signed-off-by: Siddhant Deshmukh <[email protected]>
Signed-off-by: Siddhant Deshmukh <[email protected]>
src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Siddhant Deshmukh <[email protected]>
Signed-off-by: Siddhant Deshmukh <[email protected]>
src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java
Show resolved
Hide resolved
if (anyFeatureEnabled && !super.isEnabled()) { | ||
super.setEnabled(true); | ||
if (isTopNFeaturePreviouslyDisabled) { | ||
queryInsightsService.checkAndRestartQueryInsights(); | ||
} | ||
queryInsightsService.stop(); | ||
queryInsightsService.start(); | ||
} else if (!anyFeatureEnabled && super.isEnabled()) { | ||
super.setEnabled(false); | ||
queryInsightsService.stop(); |
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.
how is the concurrency handled on this stop/start? For example, if 2 features are enabled/disabled in single settings update, how the listeners for respective settings will consume those updated values. Are the listeners executed on cluster service thread?
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.
AbstractScopedSettings
handles makes sure the applySettings
method is synchronized
Signed-off-by: Siddhant Deshmukh <[email protected]>
Signed-off-by: Siddhant Deshmukh <[email protected]>
src/test/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListenerTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListenerTests.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Siddhant Deshmukh <[email protected]>
* Make sure listener is started when query metrics enabled Signed-off-by: Siddhant Deshmukh <[email protected]> * Remove logging Signed-off-by: Siddhant Deshmukh <[email protected]> * Update unit tests Signed-off-by: Siddhant Deshmukh <[email protected]> * Address review comments Signed-off-by: Siddhant Deshmukh <[email protected]> * Refactor enable/disable feature logic Signed-off-by: Siddhant Deshmukh <[email protected]> * Address review comments Signed-off-by: Siddhant Deshmukh <[email protected]> * Remove concurrency not required Signed-off-by: Siddhant Deshmukh <[email protected]> * Remove unnecessary call Signed-off-by: Siddhant Deshmukh <[email protected]> --------- Signed-off-by: Siddhant Deshmukh <[email protected]> (cherry picked from commit 99ccbca) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…project#74) * Make sure listener is started when query metrics enabled Signed-off-by: Siddhant Deshmukh <[email protected]> * Remove logging Signed-off-by: Siddhant Deshmukh <[email protected]> * Update unit tests Signed-off-by: Siddhant Deshmukh <[email protected]> * Address review comments Signed-off-by: Siddhant Deshmukh <[email protected]> * Refactor enable/disable feature logic Signed-off-by: Siddhant Deshmukh <[email protected]> * Address review comments Signed-off-by: Siddhant Deshmukh <[email protected]> * Remove concurrency not required Signed-off-by: Siddhant Deshmukh <[email protected]> * Remove unnecessary call Signed-off-by: Siddhant Deshmukh <[email protected]> --------- Signed-off-by: Siddhant Deshmukh <[email protected]>
Description
Listener is only started when Top N is enabled. We need to also start the listener when query metrics is enabled.
Also completed some minor refactoring and updating tests.
Issues Resolved
List any issues this PR will resolve, e.g. Closes [...].
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.