Skip to content

ingest: compile mustache template only if field includes '{{''#37207

Merged
jakelandis merged 5 commits intoelastic:masterfrom
jakelandis:37120
Jan 9, 2019
Merged

ingest: compile mustache template only if field includes '{{''#37207
jakelandis merged 5 commits intoelastic:masterfrom
jakelandis:37120

Conversation

@jakelandis
Copy link
Copy Markdown
Contributor

Prior to this change, any field in an ingest node processor that supports
script templates would be compiled as mustache template regardless if they
contain a template or not. Compiling normal text as mustache templates is
harmless. However, each compilation counts against the script compilation
circuit breaker. A large number of processors without any templates or scripts
could un-intuitively trip the too many script compilations circuit breaker.

This change simple checks for '{{' in the text before it attempts to compile.

fixes #37120

Prior to this change, any field in an ingest node processor that supports
script templates would be compiled as mustache template regardless if they
contain a template or not. Compiling normal text as mustache templates is
harmless. However, each compilation counts against the script compilation
circuit breaker. A large number of processors without any templates or scripts
could un-intuitively trip the too many script compilations circuit breaker.

This change simple checks for '{{' in the text before it attempts to compile.

fixes elastic#37120
@jakelandis jakelandis added :Distributed/Ingest Node Execution or management of Ingest Pipelines v7.0.0 v6.6.0 labels Jan 8, 2019
@jakelandis jakelandis requested a review from martijnvg January 8, 2019 00:16
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-features

@jasontedor jasontedor added v6.7.0 and removed v6.6.0 labels Jan 8, 2019
Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

👍 - there are two unused imports that make the pr build fail, but other than that LGTM.

@jakelandis
Copy link
Copy Markdown
Contributor Author

thanks @martijnvg ! unused imports removed. will wait for green to merge.

@jakelandis
Copy link
Copy Markdown
Contributor Author

@elasticmachine run gradle build tests 1

1 similar comment
@jakelandis
Copy link
Copy Markdown
Contributor Author

@elasticmachine run gradle build tests 1

@jakelandis
Copy link
Copy Markdown
Contributor Author

@elasticmachine run gradle build tests 1
@elasticmachine run gradle build tests 2

@jakelandis jakelandis merged commit 1958730 into elastic:master Jan 9, 2019
jakelandis added a commit that referenced this pull request Jan 10, 2019
* ingest: compile mustache template only if field includes '{{''

Prior to this change, any field in an ingest node processor that supports
script templates would be compiled as mustache template regardless if they
contain a template or not. Compiling normal text as mustache templates is
harmless. However, each compilation counts against the script compilation
circuit breaker. A large number of processors without any templates or scripts
could un-intuitively trip the too many script compilations circuit breaker.

This change simple checks for '{{' in the text before it attempts to compile.

fixes #37120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ingest: only compile templates if the value is templated

6 participants