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

[draft] Feature: match_fields v2 #325

Open
vadimalekseev opened this issue Mar 26, 2023 · 0 comments
Open

[draft] Feature: match_fields v2 #325

vadimalekseev opened this issue Mar 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@vadimalekseev
Copy link
Collaborator

vadimalekseev commented Mar 26, 2023

match_fields allows us to selectively apply Actions. But the current implementation of match_fields does not allow us to do things like empty string checking, object type checking, etc.

We have two ways: write own query language or describe it in config.

The new API will look like this:

pipelines:
  k8s:
    actions:
      - type: 'modify'
        service: 'unknown'
        do_if:
          - cond: 'equal'
            field: 'service'
            value: null
            or: # TODO: same is a new condition?
              - cond: 'equal'
                # field: 'service' -- 'field' was inherited from the parent
                value: ''

      - type: 'modify'
        message: 'Invalid message'
        do_if:
          - cond: 'type_equal'
            field: 'message'
            invert: true
            value: 'string'

      - type: 'modify'
        level: 'unknown'
        do_if:
          - cond: 'equal'
            field: 'level'
            value: null
          - cond: 'equal'
            field: 'level'
            value: ''

      - type: 'throttle'
        do_if:
          - cond: 'equal'
            field: 'service'
            value: 'unknown'
            and:
              - cond: 'prefix'
                invert: true
                field: 'level'
                value: 'err'
              - cond: 'in'
                invert: true
                field: 'level'
                value: ['panic', null, 'warn']

      - type: 'modify'
        important_event: true
        do_if:
          cond: 'equal'
          invert: true
          field: 'service'
          value: 'unknown'
          and:
            cond: 'in'
            field: 'level'
            value: [ 'error', 'warn' ]

It looks wordy than creating own language, but greatly simplifies the implementation.
I’ll explore alternative solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant