-
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: workflow.status is now set properly in metrics. Fixes #8895 #8939
Conversation
Signed-off-by: Dillen Padhiar <[email protected]>
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.
perhaps we should add something to the workflow/controller/operator_metrics_test.go
as well
@dpadhiar can you add test? |
Signed-off-by: Dillen Padhiar <[email protected]>
return nil | ||
} | ||
|
||
func (woc *wfOperationCtx) setGlobalRuntimeParameters() { | ||
woc.globalParams[common.GlobalVarWorkflowStatus] = string(woc.wf.Status.Phase) | ||
} |
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.
Maybe the duration can be part of this function as well
argo-workflows/workflow/controller/operator.go
Lines 247 to 252 in 7fed546
// Update workflow duration variable | |
if woc.wf.Status.StartedAt.IsZero() { | |
woc.globalParams[common.GlobalVarWorkflowDuration] = fmt.Sprintf("%f", time.Duration(0).Seconds()) | |
} else { | |
woc.globalParams[common.GlobalVarWorkflowDuration] = fmt.Sprintf("%f", time.Since(woc.wf.Status.StartedAt.Time).Seconds()) | |
} |
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.
Will add.
- key: playground_id_workflow_counter | ||
value: test | ||
- key: status | ||
value: Succeeded |
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.
should be "{{workflow.status}}"?
startedAt: "2022-06-10T20:29:42Z" | ||
` | ||
|
||
func TestRuntimeMetrics(t *testing.T) { |
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 don't think this is testing the orignal bug.
You can write wf.yaml without the status
do operate twice with a pod phase change in between
and check metric before and after the 2nd operate to make sure it is changing
makePodsPhase(ctx, woc, apiv1.PodSucceeded)
woc = newWorkflowOperationCtx(woc.wf, controller)
woc.operate(ctx)
@tczhao When I am testing with
The line it is failing on is |
Signed-off-by: Dillen Padhiar <[email protected]>
Curious, I ran the failed e2e test locally and it worked fine |
If I run the test again on Github, it may pass again. I've had multiple PRs where an e2e test that was unedited failed for taking too long at times. |
Signed-off-by: Dillen Padhiar <[email protected]>
Is there any plan to release this in the upcoming release? I noticed this issue since v3.3.1 and have been waiting for the fix to be merged. Thanks! |
Signed-off-by: Dillen Padhiar [email protected]
Fixes #8895
In Argo workflows v3.3.6, it was found that running an example workflow for custom metrics at the workflow & template levels would publish
{{workflow.status}}
as an empty value instead of showing the correct status. This is because the global runtime parameters are not accurately reflected by the stored workflow spec.Example workflow (original issue):
Completed workflow spec: