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

in_http: Fix "ignored parser options" problem on bulk insertion #2055

Merged
merged 1 commit into from
Jul 11, 2018

Conversation

fujimotos
Copy link
Member

@fujimotos fujimotos commented Jul 5, 2018

This patch fixes the bug reported by #2035 (and other related issues as well).

Problem

What used to happen is that options in the <parser> section get ignored
when we send events as a JSON array. This occurs because parser plugins
are designed to handle a single hash value and do not generallly handle
an array input well.

Until now, we have tried to solve this issue by emulating the semantics
of parser plugins in Fluent::Plugin::HttpInput (see 1afbfb1, 39f3a0d
and f560017). However, this approach turned out to be error prone and
rather tedious.

More Generalized solution

This patch takes a different path:

  • Whenever @parser is available, reuse @parser.convert_values() by
    manually applying it to each record in an input array.
  • Otherwise, fall back to the current logic.

The good part of this approach is that we do not need to duplicate the same
code in in_http and parser_json anymore, and it fixes this class of related
issues.

Signed-off-by: Fujimoto Seiji fujimoto@clear-code.com

What used to happen is that options in the <parser> section get ignored
when we send events as a JSON array. This occurs because parser plugins
are designed to handle a single hash value and do not generallly handle
an array input well.

Until now, we have tried to solve this issue by emulating the semantics
of parser plugins in Fluent::Plugin::HttpInput (see 1afbfb1, 39f3a0d
and f560017). However, this approach turned out to be error prone and
rather tedious.

This patch takes a different approach:

 - Whenever @parser is available, reuse @parser.convert_values() by
   manually applying it to each record in an input array.
 - Otherwise, fall back to the current logic.

... and should solve this class of issues.

Signed-off-by: Fujimoto Seiji <fujimoto@clear-code.com>
@repeatedly repeatedly merged commit c60dd90 into fluent:master Jul 11, 2018
@repeatedly
Copy link
Member

Thanks!

@fujimotos fujimotos deleted the sf/in-http-parser branch July 17, 2018 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants