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

Common changes needed to support dynamic en/disabling of config overrides #294

Merged
merged 8 commits into from
Jul 29, 2020

Conversation

ktkrg
Copy link
Contributor

@ktkrg ktkrg commented Jul 20, 2020

Issue #:
Fixes #290
Description of changes:
This change adds the common code needed for supporting dynamic enabling and disabling of rcas, deciders, and actions.

The actual changes for applying the config overrides will be in the next PR after this gets merged. It's currently in a branch: performance-analyzer-rca/ktkrg-ed2 branch.

Tests:

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 20, 2020

Codecov Report

Merging #294 into master will increase coverage by 0.10%.
The diff coverage is 77.35%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #294      +/-   ##
============================================
+ Coverage     67.26%   67.37%   +0.10%     
- Complexity     1949     1987      +38     
============================================
  Files           286      291       +5     
  Lines         12712    12817     +105     
  Branches       1034     1042       +8     
============================================
+ Hits           8551     8635      +84     
- Misses         3798     3816      +18     
- Partials        363      366       +3     
Impacted Files Coverage Δ Complexity Δ
...lyzer/config/overrides/ConfigOverridesWrapper.java 42.85% <42.85%> (ø) 2.00 <2.00> (?)
...eanalyzer/reader/ClusterDetailsEventProcessor.java 70.23% <50.00%> (ø) 14.00 <0.00> (ø)
...alyzer/config/overrides/ConfigOverridesHelper.java 65.00% <65.00%> (ø) 6.00 <6.00> (?)
...anceanalyzer/config/overrides/ConfigOverrides.java 100.00% <100.00%> (ø) 5.00 <5.00> (?)
...ceanalyzer/decisionmaker/actions/ImpactVector.java 81.25% <0.00%> (-18.75%) 10.00% <0.00%> (+1.00%) ⬇️
...rch/performanceanalyzer/rca/framework/api/Rca.java 80.00% <0.00%> (-14.29%) 5.00% <0.00%> (ø%)
...erformanceanalyzer/rca/scheduler/RCAScheduler.java 66.17% <0.00%> (-2.95%) 9.00% <0.00%> (ø%)
...r/decisionmaker/actions/TimedFlipFlopDetector.java 93.75% <0.00%> (ø) 15.00% <0.00%> (?%)
...rformanceanalyzer/collections/TimeExpiringSet.java 83.33% <0.00%> (ø) 6.00% <0.00%> (?%)
... and 6 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 781ae08...fdbf2c9. Read the comment docs.

Copy link
Contributor

@khushbr khushbr left a comment

Choose a reason for hiding this comment

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

Minor: We are missing License information from all the new files.

});

if (configOverrides == null && exception[0] != null) {
// re throw the exception that was consumed while deserializing.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we also want to add a metric 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.

I've added the metric where we call deserialize() in ClusterDetailsEventProcessor, I'll send the PR after this gets merged as that PR depends on this change.

@ktkrg ktkrg added the enhancement Enhancements to existing codebase label Jul 27, 2020
@ktkrg ktkrg self-assigned this Jul 27, 2020
* @throws IOException if conversion runs into an IOException.
*/
public static ConfigOverrides deserialize(final String overrides) throws IOException {
final IOException[] exception = new IOException[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain if this is a one element array, why does it needs to be an array, can't it just be a single reference ?

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 can't use a local variable inside the lambda because it needs to be effectively final so we need a one element array(or any wrapper around the exception) to fish the exception out of the lambda into the calling code. I've added this as a javadoc comment as well.

*/
public class ConfigOverridesHelper {

private static final ObjectMapper MAPPER = new ObjectMapper();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a static final object. Some of the decider actions are node level. I don't think this will work with the RCA-IT framework if we just have a static object mapper here, unless the Overrides object haves nodeId as a parameter, in my opinion.

Copy link
Contributor Author

@ktkrg ktkrg Jul 27, 2020

Choose a reason for hiding this comment

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

This is only to help deserialize the string from ClusterDetailsEventProcessor into the override object. It's then updated in the RcaConf. This change will come in the next PR. This PR is only introducing the common classes needed by both the reader and the writer.

Edit:
It's used only as a helper, and it didn't make sense to create an instance of the helper object and pass it around to serialize and deserialize the overrides so decided to make it static. It does not mutate any state and works only on the arguments supplied.

The ClusterDetailsEventProcessor calls ConfigOverridesHelper.deserialize(lines[1]) in its processEvent method passing in whatever the writer has written as overrides through the NodeDetailsCollector.

@ktkrg ktkrg requested a review from yojs July 27, 2020 21:58
@yojs yojs merged commit f1c0f03 into master Jul 29, 2020
@yojs yojs deleted the ktkrg-en-disable branch July 29, 2020 20: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.

Create common structures needed to support dynamic config overrides.
3 participants