-
Notifications
You must be signed in to change notification settings - Fork 20
Make RCA framework NOT use ClusterDetailsEventProcessor #274
Conversation
Codecov Report
@@ 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 Continue to review full report at Codecov.
|
} | ||
|
||
public InstanceDetails getInstanceDetails() { | ||
return this.appContext.getMyInstanceDetails(); |
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.
do wen need to check whether appContext is null here to avoid null pointer exception ?
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.
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) { |
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.
add javadoc for this function ?
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.
Do we really want a javadoc for a setter ?
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
…deDetails" except for periodic samplers
…or from the RCA code. Except for the Periodic Samplers.
…icsRequestHandler
b90ee07
to
fc0f4ef
Compare
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.
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.
src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/AppContext.java
Outdated
Show resolved
Hide resolved
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.
One other clean up nit: Remove import statements for ClusterDetailsEventProcessor now that we're not using them.
Good point ! removed all unused imports |
This reverts commit 95c19b6.
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.