-
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
Symmetric time parse and format #1207
Conversation
…rser/formatter and inject(/extract)
@repeatedly could you review this change? |
config_param :time_key, :string, default: nil | ||
config_param :time_type, :enum, list: [:float, :unixtime, :string], default: :float | ||
|
||
Fluent::TimeMixin::TIME_PARAMETERS.each do |name, type, opts| |
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.
Why don't you use include Fluent::TimeMixin::TimeParameters
?
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.
Because that mixin adds parameters on the top namespace, not in <extract>
sections.
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.
I see. implementation limitation...
Off topic. Cache machanizm of parser / formatter becomes overhead for msec / nsec times. |
Fluent::Test.setup | ||
end | ||
|
||
def test_call_with_parse |
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.
What does 'call' mean?
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.
I have no idea: it's just moved from test/plugin/test_parser_time.rb
to there.
Other LGTM. |
This patch is to provide consistent API about time and tag, handling these on records.
Provided things:
#call
method (and#parse
/#format
)With this patch, formatter plugins can get TimeFormatter instances anytime via
time_formatter_create
method with configured format/timezone by users in<format>
section.Parser plugins also does it via
time_parser_create
.Input/Output plugins can use
inject
/extract
plugin helpers with just same configuration parameter names. It provides consistent how-to-use for users.