Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Make RCA framework NOT use ClusterDetailsEventProcessor #274

Merged
merged 10 commits into from
Jul 16, 2020

Conversation

yojs
Copy link
Contributor

@yojs yojs commented Jul 14, 2020

Using the static classes have problems as one instance of JVM can have only one instance of the class running. ClusterDetailsEventProcessor is an important class as it contains the instance details. If we want to simutate multiple RCAControllers running as part of a single JVM for the purpose of IntegrationTest framework, we should make ClusterDetailsEventProcessor a non-static class, such that each RcaController can work with its own. This is not the complete removal of the static methods in the ClusterDetailsEventProcessor, but just making the RCA framework not use them. There will be follow up PRs that will eventually make ClusterDetailsEventProcessor non-static

Issue #, if available:

Description of changes:

Tests:

Code coverage percentage for this patch:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Jul 14, 2020

Codecov Report

Merging #274 into master will increase coverage by 0.07%.
The diff coverage is 85.86%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #274      +/-   ##
============================================
+ Coverage     66.14%   66.21%   +0.07%     
- Complexity     1789     1802      +13     
============================================
  Files           270      272       +2     
  Lines         11988    12027      +39     
  Branches        952      953       +1     
============================================
+ Hits           7929     7964      +35     
- Misses         3744     3750       +6     
+ Partials        315      313       -2     
Impacted Files Coverage Δ Complexity Δ
...ch/performanceanalyzer/PerformanceAnalyzerApp.java 40.19% <0.00%> (-0.40%) 4.00 <0.00> (ø)
...rch/performanceanalyzer/rca/util/ClusterUtils.java 84.61% <ø> (+8.14%) 4.00 <0.00> (-1.00) ⬆️
...eanalyzer/reader/ClusterDetailsEventProcessor.java 69.84% <ø> (+6.34%) 15.00 <0.00> (+2.00)
.../performanceanalyzer/rca/store/rca/HotNodeRca.java 50.00% <66.66%> (-2.09%) 6.00 <0.00> (-1.00)
...er/rca/store/rca/threadpool/QueueRejectionRca.java 75.36% <66.66%> (ø) 9.00 <0.00> (ø)
...erformanceanalyzer/rca/scheduler/RCAScheduler.java 71.42% <75.00%> (-4.38%) 9.00 <0.00> (-2.00)
.../elasticsearch/performanceanalyzer/AppContext.java 80.00% <80.00%> (ø) 3.00 <3.00> (?)
...csearch/performanceanalyzer/rca/RcaController.java 81.48% <100.00%> (+0.85%) 36.00 <3.00> (+2.00)
...h/performanceanalyzer/rca/framework/core/Node.java 93.61% <100.00%> (+0.43%) 26.00 <2.00> (+2.00)
...ceanalyzer/rca/framework/util/InstanceDetails.java 100.00% <100.00%> (ø) 6.00 <6.00> (?)
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b39d252...b8387e1. Read the comment docs.

}

public InstanceDetails getInstanceDetails() {
return this.appContext.getMyInstanceDetails();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do wen need to check whether appContext is null here to avoid null pointer exception ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @rguo-aws Will add it

@@ -187,4 +194,20 @@ public void setLocalFlowUnit(T localFlowUnit) {
public void readRcaConf(RcaConf conf) {
return;
}

public void setAppContext(final AppContext appContext) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add javadoc for this function ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want a javadoc for a setter ?

yojs added 6 commits July 15, 2020 10:56
Using the static classes have problems as one instance of JVM can have only one instance of the class running. ClusterDetailsEventProcessor is an important class as it contains the instance details. If we want to simutate multiple RCAControllers running as part of a single JVM for the purpose of IntegrationTest framework, we should make ClusterDetailsEventProcessor a non-static class, such that each RcaController can work with its own. This is not the complete removal of the static methods in the ClusterDetailsEventProcessor, but just making the RCA framework not use them. There will be follow up PRs that will eventually make ClusterDetailsEventProcessor non-static
…or from the RCA code. Except for the Periodic Samplers.
@yojs yojs force-pushed the refactor-ClusterDetailsEventProcessor branch from b90ee07 to fc0f4ef Compare July 15, 2020 18:29
Copy link
Contributor

@ktkrg ktkrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked for the following cross thread access:

  • AppContext <- ClusterDetailsEventProcessor
  • AppContext -> other threads.

It looks good to me. I just left a minor nit.

Copy link
Contributor

@ktkrg ktkrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other clean up nit: Remove import statements for ClusterDetailsEventProcessor now that we're not using them.

@yojs
Copy link
Contributor Author

yojs commented Jul 16, 2020

Good point ! removed all unused imports

@rguo-aws rguo-aws merged commit 95c19b6 into master Jul 16, 2020
@yojs yojs deleted the refactor-ClusterDetailsEventProcessor branch July 16, 2020 00:42
sidheart pushed a commit that referenced this pull request Jul 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants