-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fixes #23469: Reporting by node is not correct on directives and Rules #5050
base: branches/rudder/7.3
Are you sure you want to change the base?
Conversation
subComponents.flatMap(_.withFilteredElement(predicate)) match { | ||
case Nil => None | ||
case l => Some(this.copy(subComponents = l)) | ||
} | ||
} | ||
|
||
def status: ReportType = { | ||
val status: ReportType = { |
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 think we are oscillating between def and val because val (or lazy val) makes the number of allocation/memory consumption exploses. Did you look in history to see if we did the opposite change at some point?
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.
It should at least be lazy val
I believe (like other status
field like in ComponentValueStatusReport
, in all case not a val since it override a base field, it may lead to NPE)
|
||
def componentValues(v: String): List[ByRuleNodeCompliance] = componentValues.filter(_.values.exists(_.componentValue == v)) | ||
|
||
def status: ReportType |
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.
the meaning of status here is "the worst report type in sub component, based on target rules?"
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.
In fact i don't think it's used by component but i may be wrong, but for value it's is the worst in all cases. Probably in a block it should depends on reporting logic, But I'm not sure it is really used for a block
.
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.
Can you add a unit test that is failing before the change and green after ?
So, better understanding: it is not something that was wrong, more a missing feature.
|
https://issues.rudder.io/issues/23469
This pr is mostly replicating ComponentStatusReport behavior on other compliance view/types (mostly, applying blocks reporting logic)
I guess that we may have to refactor this and find out how to provide some abstraction over this. I have quite some idea but ...
It also simplifies a lot how the reports were regrouped by node, we were doing something really complicated but we just need to go deeper first (https://github.com/Normation/rudder/pull/5050/files#diff-c69298aa223fd7b6060cbed8a56d0472af28fd9ca9acdd466afc4f599ca56b8cL390 ) no more group by. Just explore at each level then regroup, almost again like we are doing for ComponentStatusReport ...
I also changed some "static" def, on several objects from def to val or lazy val. I think that may save us some computation time if we called them several times