Skip to content

Add trigger weight to route events #3800

@lukasmrtvy

Description

@lukasmrtvy

Is your feature request related to a problem? Please describe.
I would like to route events to triggers based on the global event count. This way, one can for example "offload" 30% of events to a different trigger. The easiest way would be to expose argo_events_event_service_running_total metric as a variable I guess, or at least interduce some stateful counter() function available in triggers condition field.

Thanks

Describe the solution you'd like

Simple one:

apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
  name: aws-sqs
spec:
  dependencies:
    - name: test-dep
      eventSourceName: aws-sqs
      eventName: example
  triggers:
    - template:
        name: workflow_foo
        conditions: "counter() % 3 == 0"
    - template:
        name: workflow_bar
        conditions: "counter() % 3 != 0"

with a weight field:

apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
  name: aws-sqs
spec:
  dependencies:
    - name: test-dep
      eventSourceName: aws-sqs
      eventName: example
  triggers:
    - template:
        name: workflow_foo
        weight: 30
    - template:
        name: workflow_bar
        weight: 70

Describe alternatives you've considered
Do this before Argo Events

Additional context


Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions