-
Notifications
You must be signed in to change notification settings - Fork 73
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 #22150: API for directive compliance #4606
Fixes #22150: API for directive compliance #4606
Conversation
~ ("compliance" -> directive.compliance.complianceWithoutPending(precision)) | ||
~ ("mode" -> directive.mode.name) | ||
~ ("complianceDetails" -> percents(directive.compliance, precision)) | ||
~ ("rules" -> rules(directive.rules, level, precision)) |
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 struggle to get the rules that contain nodes and nodes that contain rules. It seems like it's always rules -> directives -> nodes
Commit modified |
7a13e1f
to
b0b58aa
Compare
~ ("mode" -> directive.mode.name) | ||
~ ("complianceDetails" -> percents(directive.compliance, precision)) | ||
// ~ ("rules" -> rules(directive.rules.map(_.), level, precision)) | ||
~ ("nodes" -> byNodes(directive.nodes, level, precision)) |
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'm trying to get a structure like
"nodes": [
{
"id": "831b9c93-bb96-4d48-8c4e-91ca19b98bde",
"name": "prod-zabbix-01.lab.rudder.io",
"compliance": 100.0,
"complianceDetails": {
"auditCompliant": 100.0
},
"rules": [
{
"id": "94e9b2ed-6f5a-44a2-a8c5-82b88f4d85b7",
"name": "Training - Trigger Command",
"compliance": 100.0,
"complianceDetails": {
"auditCompliant": 100.0
},
"components": [
{
"name": "Copy script agent-hello onto Nodes ",
"compliance": 100.0,
"complianceDetails": {
"auditCompliant": 100.0
},
"values": [
{
"value": "/opt/rudder/share/commands/agent-hello",
"reports": [
{
"status": "auditCompliant",
"message": "Copying /opt/rudder/share/commands/agent-hello from agent-hello was correct"
}
]
}
]
}
]
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.
why do you have a rule and not a directive?
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.
directive is at top level. we want compliance for a directive
Commit modified |
b0b58aa
to
4bc69b7
Compare
directive.map(_.id.uid.value).getOrElse("Unknown"), | ||
ComplianceLevel.sum(byRules.map(_.compliance)), | ||
compliance.mode, | ||
byRules, |
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.
Here we expect Seq[ByDirectiveByRuleComponentCompliance]
but getByRulesCompliance
return Seq[ByRuleRuleCompliance]
Commit modified |
4bc69b7
to
83e328a
Compare
Commit modified |
83e328a
to
07b61de
Compare
Commit modified |
07b61de
to
2d75e0a
Compare
Commit modified |
2d75e0a
to
0de5f23
Compare
Commit modified |
0de5f23
to
b325de9
Compare
Commit modified |
b325de9
to
b3a987c
Compare
OK, merging this PR |
@@ -160,6 +160,13 @@ object ComplianceApi extends ApiModuleProvider[ComplianceApi] { | |||
val dataContainer = Some("globalCompliance") | |||
} | |||
|
|||
final case object GetDirectiveComplianceId extends ComplianceApi with OneParam with StartsAtVersion10 with SortIndex { |
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.
why does it start at version 10 and not latest version ?
_ = TimingDebugLogger.trace(s"API GetDirectiveId - getting directive compliance in ${t3 - t2} ms") | ||
|
||
} yield { | ||
if (version.value <= 6) { |
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 starts only in rudder 7.3, so there's no way the version 6 of API is possible
https://issues.rudder.io/issues/22150