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

Propagate correlationId label also to the initial flow that triggered the subflow #5644

Open
anna-geller opened this issue Oct 23, 2024 · 7 comments · May be fixed by #5658
Open

Propagate correlationId label also to the initial flow that triggered the subflow #5644

anna-geller opened this issue Oct 23, 2024 · 7 comments · May be fixed by #5658
Assignees
Labels
area/backend Needs backend code changes enhancement New feature or request kind/quick-win Seems to be quick to do

Comments

@anna-geller
Copy link
Member

Feature description

Let's say we have 3 flows, parent called flow1 and two subflows flow2 and flow3 triggered in a chain:

flow1 --> flow2 --> flow3

Currently, the executionId of flow1 will be propagated as system_correlationId label to flow2 and flow3 but I believe flow1 should also get the same label to clearly indicate all flows in the chain incl. the initial one

image

To reproduce:

id: flow1
namespace: company.team
tasks:
  - id: subflow
    type: io.kestra.plugin.core.flow.Subflow
    namespace: company.team
    flowId: flow2
id: flow2
namespace: company.team
tasks:
  - id: subflow
    type: io.kestra.plugin.core.flow.Subflow
    namespace: company.team
    flowId: flow3
id: flow3
namespace: company.team
tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: hello from the last flow
@anna-geller anna-geller added area/backend Needs backend code changes enhancement New feature or request kind/quick-win Seems to be quick to do labels Oct 23, 2024
@loicmathieu
Copy link
Member

This is not that easy as when we propagate the correlationId to the first subflow, we cannot update the parent execution.
We can add the correlationId to all execution but it would just be a duplicate of the executionId.

This needs investigation on how to do this the best.

@anna-geller
Copy link
Member Author

interesting, I thought we could add this label (as below but automatically) to all executions that have at least 1 subflow task and don't have any upstream parent execution ID?

id: flow1
namespace: company.team

labels:
  system_correlationId: "{{ flow.executionId }}"

tasks:
  - id: subflow
    type: io.kestra.plugin.core.flow.Subflow
    namespace: company.team
    flowId: flow2

We can add the correlationId to all execution but it would just be a duplicate of the executionId.

This would run the risk that the subflow execution would get its own correlationId (equal to is own executionId) overriding the one it got from parent right?

@loicmathieu
Copy link
Member

It may be a way to do it, a little brittle

@anna-geller
Copy link
Member Author

Ludo suggests to explore the option that if there is no correlationId (e.g. no such ID passed from a parent execution), we should add correlationId equal to the current executionId

@loicmathieu
Copy link
Member

It's easy if we add the label to all executions but this would clutter all executions with a useless label.

But as I said, the challenge is that at the point we will execute a subflow, we cannot set this label to the current execution.

@anna-geller
Copy link
Member Author

feel free to discuss this with Ludo, no strong opinions, to me the most important part is that we add it to the first parent flow in the chain 👍

@loicmathieu
Copy link
Member

Decision has been to add the system_correlationId field on all executions that didn't have one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend Needs backend code changes enhancement New feature or request kind/quick-win Seems to be quick to do
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

2 participants