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

Add ability to ignore a missing pipeline to the pipeline processor #87323

Closed
joshdover opened this issue Jun 2, 2022 · 2 comments · Fixed by #87354
Closed

Add ability to ignore a missing pipeline to the pipeline processor #87323

joshdover opened this issue Jun 2, 2022 · 2 comments · Fixed by #87354
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >enhancement Team:Data Management Meta label for data/management team

Comments

@joshdover
Copy link
Contributor

Description

I’m trying to create a pipeline processor that will avoid throwing errors if the pipeline it’s referencing doesn’t exist, but will still throw errors if the pipeline does exist but fails. It seems there are two potential approaches:

1. Add a on_failure block that can handle this case

My initial idea was to use an on_failure block with a single fail processor that has a condition to not fail if the failure was due to non-existent pipeline error. However, it seems I can’t figure how to access the _ingest.on_failure_* fields from within the if condition, but they are accessible from within the message option. I tried accessing this via ctx['_ingest'] as well without any luck. It seems we need code changes to expose this to the if painless context. Here’s the pipeline I’m trying to create:

PUT _ingest/pipeline/test-pipeline
{
  "processors": [
    {
      "pipeline": {
        "name": "test-custom",
        "tag": "fleet-custom-caller",
        "on_failure": [
          {
            "fail": {
              "if": "_ingest.on_failure_processor_type != 'pipeline' || _ingest.on_failure_processor_tag != 'fleet-custom-caller' || !_ingest.on_failure_message.contains('non-existent pipeline [test-custom]')",
              "message": "test-custom pipeline failed with {{ _ingest.on_failure_message }}"
            }
          }
        ]
      }
    }
  ]
}

2. Add a dedicated ignore_missing option to the pipeline processor

As @felixbarny has discussed in elastic/package-spec#129 (comment), it's probably preferable to have a dedicated processor option for this in order to:

  1. Avoid creating an exception at all and the overhead involved
  2. Have a less fragile solution that is not dependent on an error message string
PUT _ingest/pipeline/test-pipeline
{
  "processors": [
    {
      "pipeline": {
        "name": "test-custom",
        "ignore_missing": true
      }
    }
  ]
}
@joshdover joshdover added >enhancement :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP Team:Data Management Meta label for data/management team needs:triage Requires assignment of a team area label labels Jun 2, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

martijnvg added a commit to martijnvg/elasticsearch that referenced this issue Jun 3, 2022
Add `ignore_missing_pipeline` option to `pipeline` processor.
This controls whether the `pipeline` processor should fail
with an error if no pipeline with a name specified in the
`name` option exists.

This enhancement is useful to setup a pipeline infrastructure
that lazily adds extension points for overwrites. So that
for specific cluster setups custom pre-processing can be added
at a later point in time.

Relates to elastic#87323
elasticsearchmachine pushed a commit that referenced this issue Jun 7, 2022
Add `ignore_missing_pipeline` option to `pipeline` processor. This
controls whether the `pipeline` processor should fail with an error if
no pipeline with a name specified in the `name` option exists.

This enhancement is useful to setup a pipeline infrastructure that
lazily adds extension points for overwrites. So that for specific
cluster setups custom pre-processing can be added at a later point in
time.

Relates to #87323
@DaveCTurner DaveCTurner removed the needs:triage Requires assignment of a team area label label Jun 13, 2022
@felixbarny
Copy link
Member

Closing as implemented via #87354

@felixbarny felixbarny linked a pull request Aug 11, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >enhancement Team:Data Management Meta label for data/management team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants