fluent / fluent/fluentd

Add parameter types for record accessors and place holders

Open
#3,887 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Ruby
Stars
13.6k
Forks
1.4k
Avg merge
1d 3h
Merged PRs (30d)
20

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.