-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
migrating in_http to v0.14 API #1308
Conversation
9384c12
to
fdb4aa8
Compare
Without this change, Plugin.new_parser will instantiate Fluent::TextParser instance. It is a kind of Fluent::Compat::Parser, and will convert configuration for it (twice). This double conversion breaks value modification of "types" parameter.
…oating point value)
fdb4aa8
to
27be8bc
Compare
@repeatedly Could you review this change? |
I will check it later.
I think this is no problem. |
… expression directly. It's because old TextParser estimates to parse "time" field without any time_format (using Ruby built-in formats).
m = if @parser_configs.first['@type'] == 'in_http' | ||
@parser_msgpack = parser_create(type: 'msgpack') | ||
@parser_msgpack.estimate_current_event = false | ||
@parser_json = parser_create(type: 'json') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parser_create uses usage
for @_parsers
key.
This second parser_create
seems to overwrite msgpack
parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, that's right.
config_param :blocking_timeout, :time, default: 0.5 | ||
desc 'Set a white list of domains that can do CORS (Cross-Origin Resource Sharing)' | ||
config_param :cors_allow_origins, :array, default: nil | ||
desc 'Respond with empty gif image of 1x1 pixel.' | ||
config_param :respond_with_empty_img, :bool, default: false | ||
|
||
config_section :parse do | ||
config_set_default :@type, 'in_http' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is using nil
bad idea?
It can avoid InHttpParser
definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, using nil
is bad idea for here, because we can't specify nil
explicitly in configuration file.
time_i = time.to_i | ||
|
||
events = [ | ||
["tag1", time, {"REMOTE_ADDR"=>"129.78.138.66", "a"=>1}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"REMOTE_ADDR"=>"129.78.138.66"
is assigined by in_http, not emitted record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I'll fix it.
time_i = time.to_i | ||
records = [{"a"=>1},{"a"=>2}] | ||
events = [ | ||
["tag1", time, {"REMOTE_ADDR"=>"129.78.138.66", "a"=>1}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Data to be committed is records
in this test case, and events is used just for expectation.
Commented. Others are looks good. |
I pushed two commits for review comments. |
LGTM |
This change is to migrate
in_http
to v0.14 APIs, without socket/server plugin helpers (like #1306).Currently, this change disables DetachMultiProcessMixin feature, because
event_loop
plugin helper can't work with it (error below occurs when DetachMultiProcessMixin is mixed in):