-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: process metrics later in executeTemplate
. Fixes #13162
#13163
Conversation
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
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.
Ran example workflow from initial issue to test that metric is now showing.
Please do add a regression test for this. Otherwise, I'm not an expert in the templating part of the codebase so I'll let others review
Will do, can add a test case for using the metrics in a template. |
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
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.
Correct me if I'm wrong, but it looks to me like the test case can be quite heavily simplified. We should keep tests as concise and isolated as possible, using only the features we are trying to test
There are also leftover test comments in it that shouldn't make it into the codebase.
And some style issues
You are right, I did rush a bit to push the PR in (customer issue at work) so let me go ahead and clean it up / address your comments today. |
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
woc.computeMetrics(processedTmpl.Metrics.Prometheus, localScope, realTimeScope, false) | ||
} | ||
} | ||
|
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 clarify how moving the code helped? What is it about the lines above this code that they needed to be executed first?
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.
Yes, from what I went over with @sarabala1979, this line retrieveNode, err := woc.wf.GetNodeByName(node.Name)
gives us the most up to date node for the workflow. This one will have the correct Fulfilled
status and this will let us go through this logic prevNodeStatus, ok := woc.preExecutionNodePhases[node.ID]; (!ok || !prevNodeStatus.Fulfilled()) && node.Fulfilled() {
successfully to be able to call computeMetrics for a failed Workflow.
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
test/e2e/testdata/wf-template-status-failed-conditional-metric.yaml
Outdated
Show resolved
Hide resolved
executeTemplate
. Fixes #13162
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
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.
Tests LGTM now. Will let others review the rest
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.
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com> (cherry picked from commit 6201d75)
Fixes #13162
Motivation
Failure metric when defined in WorkflowTemplate wasn't being reported.
Modifications
Changed where the
processedMetrics
are checked during reconciliation such that the currentNode
shows as Failed and the metric is processed correctly.Verification
Ran example workflow from initial issue to test that metric is now showing.