Skip to content
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: compute and emit realtime metrics while node not fulfilled #13441

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2248,9 +2248,9 @@ func (woc *wfOperationCtx) executeTemplate(ctx context.Context, nodeName string,
}

if processedTmpl.Metrics != nil {
// Check if the node was just created, if it was emit realtime metrics.
// Check if the node was just created or not fulfilled, if it was emit realtime metrics.
// If the node did not previously exist, we can infer that it was created during the current operation, emit real time metrics.
if _, ok := woc.preExecutionNodePhases[node.ID]; !ok {
if _, ok := woc.preExecutionNodePhases[node.ID]; !ok || !node.Fulfilled() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Joibel What I want to modify is at the template level, my reason is that I specified when duration > 100, which means that the realtime metric is actually sent out when it is greater than 100 seconds. In fact, this metric will not be collected when it is greater than 100 seconds, because the duration is 0 when the template is just created. When calculated as false, I permanently lost this metrics.

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 think this does not conform to the definition of "when".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My expectation is that I can collect this metrics when the when condition is met.

Copy link
Member

Choose a reason for hiding this comment

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

Could you read my suggestion again. I believe it does what you're looking for 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.

Could you read my suggestion again. I believe it does what you're looking for here.

I understand, thank you.

localScope, realTimeScope := woc.prepareMetricScope(node)
woc.computeMetrics(processedTmpl.Metrics.Prometheus, localScope, realTimeScope, true)
}
Expand Down
Loading