fluentd
fluentd copied to clipboard
Add parameter types for record accessors and place holders
Is your feature request related to a problem? Please describe.
Plugin parameters define string parameters that are used to:
- specify a key of records (to be turned into
RecordAccessor
) - specify a dynamic parameter value (to be computed by
extract_placeholders
)
Those types of parameters are currently described as a string, and plugin authors have to explain what those are in the description. It's a hard thing to both plugin authors and users. If we can explain it as parameter types, the situation will be much clearer than now.
Describe the solution you'd like
Add 2 parameter types. Parameters of those types will be described clearly differently from :string
in plugin documents.
record_accessor
Parameter type record_accessor
is to instantiate a RecordAccessor
object from the parameter value.
# definition
config_param :key, :record_accessor
# configuration
key $.author.name
# usage
@key #=> RecordAccessor object
@key.call(record)
dynamic_string
Parameter type dynamic_string
is to instantiate a new type object to call extract_placeholders
with an argument chunk
.
# definition
config_param :path, :dynamic_string
# configuration
path /path/to/stored/file.${tag}.%Y_%m_%d_%H.log
# usage
@path #=> DynamicString object
@path.call(chunk) #=> /path/to/stored/file.tag.2022_09_04.log
Describe alternatives you've considered
As far as I consider, there are no alternatives to solve this (documentation) problem.
Additional context
Documentation toolchains (like fluent-plugin-config-format
) need to be updated when this idea is taken.
Hey I would really love to solve this issue please assign it to me