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

[ingest] - Error handling from simulate API #6675

Merged
merged 11 commits into from
Apr 7, 2016

Conversation

BigFunger
Copy link
Contributor

Summary

The initial version of the ingest server and client changes did not have logic to deal with when the simulate ES api would throw an error. It was written to always assume success. This is bad for two reasons: First, because things do not always go smoothly, and second because the gsub and grok processors that are coming in a later PR will throw an error if there is an invalid regular expression passed to them.

Changes

  • Added the gsub processor
    • I needed to add this processor so that we can initiate an error by sending an invalid regular expression
  • Added the dirtyProcessorId to the pipeline class. This will keep track of the processor that set the pipeline.dirty property to true. This way, if an error is raised, we know which processor caused it to happen.
  • [edit] Added logic to consume the new error format from the simulate api to determine with processor caused the compile error
  • [edit] Added throw/catch logic for any errors that come back that aren't compile errors.
  • Changed the way that the kibana ingest api returns results.
    • Previously the kibana simulate api would return results for each processor, whether an error or success is returned from the es ingest api.
    • Now, when the es simulate returns a data error, the kibana simulate api returns results for each processor up to and including the processor that generated a data error.
    • Now, when the es simulate does not return an error, the kibana simulate api returns results for each processor
    • Now, when the es simulate api returns a pipeline compile error, the kibana simulate api returns a result for only the processor that was set as the dirty processor.
  • Moved the logic that propagates api results to entire pipeline into the pipeline class
    • Previously, this logic existed in the simulate api.
  • Changed the way that 'nested' errors appear.
    • Previously, when there was an error in a middle processor of the pipeline, all subsequent processors would also be set to an error state.
    • Now, when the above mentioned situation occurs, they are just set to a 'locked' state
  • Added front end logic to handle when a pipeline-compile error occurs
    • Now each processor except the processor that returns the error is 'locked'
    • All ui that could alter the pipeline is locked until the pipeline-compile error occurs
      • Reordering processors
      • Adding processors
      • Removing processors (except processor that is causing the error)
      • Changing input data
  • Fixed bug where the last character entered into a pipeline would appear to not be processed
    • There was a premature optimization that would cause this issue. This should now be resolved.

@Bargs
Copy link
Contributor

Bargs commented Mar 28, 2016

Pipeline output becomes blank as soon as Gsub is added:

screen shot 2016-03-28 at 2 21 38 pm

@BigFunger
Copy link
Contributor Author

@Bargs wrote

Pipeline output becomes blank as soon as Gsub is added

This behavior was not introduced with this PR, and is something I plan on addressing in a future PR.

@Bargs
Copy link
Contributor

Bargs commented Mar 28, 2016

Created a ticket to track it #6679

@BigFunger BigFunger added the Feature:Add Data Add Data and sample data feature on Home label Mar 28, 2016
@@ -4,5 +4,6 @@ import _ from 'lodash';

export default Joi.object({
processors: Joi.array().items(_.values(ingestProcessorSchemas)).required().min(1),
input: Joi.object().required()
input: Joi.object().required(),
dirty_processor_id: Joi.string().optional()
Copy link
Contributor

Choose a reason for hiding this comment

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

Keys are optional by default

@Bargs
Copy link
Contributor

Bargs commented Mar 28, 2016

This needs additional api tests under test/unit/api/ingest/_simulate.js to test the updated behaviour, and a new test suite for Gsub under test/unit/api/ingest/processors/_gsub

@Bargs
Copy link
Contributor

Bargs commented Mar 28, 2016

Fixed bug where the last character entered into a pipeline would appear to not be processed

In the future, please split unrelated fixes like this into their own PR.

input: {},
processors: [{
processor_id: 'processor1',
type_id: 'set',
Copy link
Contributor

Choose a reason for hiding this comment

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

This will test the set processor schema, not gsub

@Bargs
Copy link
Contributor

Bargs commented Mar 28, 2016

@BigFunger I'm done reviewing the current code, passing back to you for updates. Please create a ticket for cleaning up the dirty_processor logic once ES has improved their errors, and link to the ES ticket for it.

@Bargs
Copy link
Contributor

Bargs commented Mar 29, 2016

@BigFunger Will you rebase this on feature/ingest? That'll get Spencer's ES fix into the branch and should get the tests running again.

Also, does this PR block the addition of the other (non-regex based) processors? Or could I be reviewing those while you're making updates to this PR?

@BigFunger
Copy link
Contributor Author

@Bargs, it does block the addition of the other processors, because this PR redefines the base flow of how processors and the pipeline work.

@Bargs
Copy link
Contributor

Bargs commented Mar 29, 2016

@BigFunger Since elastic/elasticsearch#17260 is already merged, let's remove the dirty_processor tracking from this PR. That should fix the problem with compilation error'd processors getting locked and should clean the code up nicely.

@BigFunger
Copy link
Contributor Author

Changes made per our discussion today and your above comments. I updated the description in the initial comment to reflect.

@BigFunger BigFunger assigned Bargs and unassigned BigFunger Apr 6, 2016
@Bargs
Copy link
Contributor

Bargs commented Apr 6, 2016

There's a test failure in __tests__/process_es_ingest_simulate_error.js, otherwise lgtm

@Bargs Bargs assigned BigFunger and unassigned Bargs Apr 6, 2016
@BigFunger BigFunger merged commit 889c9c1 into elastic:feature/ingest Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Add Data Add Data and sample data feature on Home review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants