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

Integration test framework to test RCAs and decision Makers #301

Merged
merged 6 commits into from
Aug 11, 2020
Merged

Conversation

yojs
Copy link
Contributor

@yojs yojs commented Jul 24, 2020

fixes: #337

Description of changes:
This PR introduces a framework that can be used to write tests concerning
RCA graph and all the components that leverage it(RCAs, Deciders etc.).
Currently it supports adding custom metrics, running tests against
single node cluster, multi-node clusters with dedicated masters and
the ones without dedicated masters. It provides a way to query the
SQLite data-store file on a particular host or hit the rest endpoint
on a particular node. Currently, the nodes of the clusters work over
http only. For more details, I would point you here

Tests:
There is a POC test to check the working of the framework.

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 Aug 3, 2020

Codecov Report

Merging #301 into master will increase coverage by 0.59%.
The diff coverage is 61.60%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #301      +/-   ##
============================================
+ Coverage     67.17%   67.76%   +0.59%     
- Complexity     2086     2135      +49     
============================================
  Files           301      301              
  Lines         13326    13403      +77     
  Branches       1104     1115      +11     
============================================
+ Hits           8952     9083     +131     
+ Misses         3970     3923      -47     
+ Partials        404      397       -7     
Impacted Files Coverage Δ Complexity Δ
...ch/performanceanalyzer/PerformanceAnalyzerApp.java 58.40% <0.00%> (+18.22%) 14.00 <0.00> (+7.00)
...formanceanalyzer/PerformanceAnalyzerWebServer.java 72.97% <0.00%> (-1.00%) 9.00 <0.00> (ø)
...rformanceanalyzer/rest/QueryRcaRequestHandler.java 48.27% <0.00%> (ø) 16.00 <1.00> (ø)
...manceanalyzer/rca/persistence/SQLitePersistor.java 68.08% <11.11%> (-4.91%) 27.00 <2.00> (+4.00) ⬇️
...erformanceanalyzer/rca/persistence/FileRotate.java 53.84% <50.00%> (+0.90%) 10.00 <0.00> (ø)
...csearch/performanceanalyzer/rca/RcaController.java 83.98% <75.60%> (+3.00%) 46.00 <6.00> (+8.00)
...erformanceanalyzer/rca/scheduler/RCAScheduler.java 67.85% <80.95%> (-1.27%) 12.00 <1.00> (+3.00) ⬇️
...ceanalyzer/rca/framework/core/ConfJsonWrapper.java 94.28% <100.00%> (-0.16%) 16.00 <1.00> (-1.00)
...nalyzer/rca/framework/core/ConnectedComponent.java 100.00% <100.00%> (ø) 19.00 <4.00> (+2.00)
...ormanceanalyzer/rca/persistence/PersistorBase.java 83.69% <100.00%> (+1.08%) 22.00 <0.00> (+2.00)
... and 19 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 e03a120...086cdb4. Read the comment docs.

@yojs yojs changed the title rca it first cut, after removing the refactoring changes in the exist… Integration test framework to test RCAs and decision Makers Aug 4, 2020
@yojs yojs requested review from ktkrg, rguo-aws, vigyasharma and khushbr and removed request for ktkrg August 4, 2020 22:55
@yojs yojs added the enhancement Enhancements to existing codebase label Aug 5, 2020
@yojs yojs requested a review from sidheart August 5, 2020 19:05
@yojs yojs force-pushed the rca-it2 branch 2 times, most recently from 8ac14bf to d5f98c1 Compare August 7, 2020 00:11
@@ -245,14 +249,14 @@ private synchronized void rotateRegisterGarbageThenCreateNewDB(RotationType type
}

/** recursively insert nested summary to sql tables */
private void writeSummary(
private synchronized void writeSummary(
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I am wrong. but since we've already added synchronized keyword in the parent function which calls this private function, do we still need to add another synchronized keyword here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No you are 100% right. Its not required. Its just that some of the private methods in the class were marked as synchronized so I made them all be so. Just making the public methods should suffice.

if (!de.getMessage().contains("no such table")) {
// it is totally fine if we fail to read some certain tables.
LOG.warn("Fail to read RCA : {}.", rca, de);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

should we print an error log if otherwise

Copy link
Contributor Author

@yojs yojs Aug 10, 2020

Choose a reason for hiding this comment

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

You mean make it an error log instead of warning ?

//check if RCA is valid
if (!validParams(rcaList)) {
// rcaList = SQLiteQueryUtils.getClusterLevelRca();
rcaList = persistable.getAllPersistedRcas();
Copy link
Contributor

Choose a reason for hiding this comment

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

this will contain RCAs that are not cluster level RCAs. Do we also want to expose node level RCAs on local master node to user ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to. Eventually, We would want to expose the RCAs on the local node, if they are not elected master.

The only thing with RCAs are that they are nested so, we won't want one node to gather RCAs from all nodes but if the request hits a node, it should be able to get all local RCAs.

@@ -178,14 +185,6 @@ private void handleClusterRcaRequest(Map<String, String> params, HttpExchange ex
HttpURLConnection.HTTP_BAD_REQUEST);
return;
}
//check if we are querying from elected master
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we would want to

yojs added 4 commits August 10, 2020 16:00
This PR introduces a framework that can be used to write tests concerning
RCA graph and all the components that leverage it(RCAs, Deciders etc.).
Currently it supports adding custom metrics, running tests against
single node cluster, multi-node clusters with dedicated masters and
the ones without dedicated masters. It provies a way to query the
SQLite datastore file on a particular host or hit the rest endpoint
on a particular node. Currently, the nodes of the clsuters work over
http only.
Copy link
Contributor

@sidheart sidheart left a comment

Choose a reason for hiding this comment

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

This is basically JUnit for RCAs. It's insane how cool this is. I just have a few minor nits, the logic in here is solid and it's pretty much ready to merge.

@yojs yojs merged commit e358f20 into master Aug 11, 2020
@yojs yojs deleted the rca-it2 branch August 11, 2020 18:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Enhancements to existing codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration Test Framework for the RCA framework
3 participants