Skip to content
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

Merged
merged 8 commits into from
Aug 28, 2024

Conversation

deshsidd
Copy link
Collaborator

@deshsidd deshsidd commented Aug 24, 2024

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.

Signed-off-by: Siddhant Deshmukh <[email protected]>
Signed-off-by: Siddhant Deshmukh <[email protected]>
Signed-off-by: Siddhant Deshmukh <[email protected]>
Signed-off-by: Siddhant Deshmukh <[email protected]>
Comment on lines 145 to 151
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();
Copy link
Collaborator

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?

Copy link
Collaborator Author

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]>
Signed-off-by: Siddhant Deshmukh <[email protected]>
@jainankitk jainankitk merged commit 99ccbca into opensearch-project:main Aug 28, 2024
16 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 28, 2024
* 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>
deshsidd pushed a commit that referenced this pull request Aug 28, 2024
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
dzane17 pushed a commit to dzane17/query-insights that referenced this pull request Aug 30, 2024
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants