change elasticsearch configuration DecodeHook function to handle string to []string#11732
Conversation
|
This pull request does not have a backport label. Could you fix it @leehinman? 🙏
|
b0ddd05 to
a84bb87
Compare
There was a problem hiding this comment.
While this change would work, it seems the only effect we're interested in is:
single values are converted to slices if required. Each element is weakly decoded. For example: "4" can become []int{4} if the target type is an int slice.
Since we're already defining a DecodeHook function, cfgDecodeHookFunc, would it be possible to use this function to convert T values into []T values if the target type is []T? That might be preferable/safer if we don't want or expect the rest of the implications of using WeaklyTypedInput?
I was waffling on this myself. I leaned towards the |
8d1a9ce to
d541e9e
Compare
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
ycombinator
left a comment
There was a problem hiding this comment.
LGTM once the linter failures are addressed.
💛 Build succeeded, but was flaky
Failed CI StepsHistory
cc @leehinman |
… function to handle string to []string (#11818) * change elasticsearch configuration DecodeHook function to handle string to []string (#11732) handle type to []type mismatch for - string - cipher suite - tls version in elasticsearch output translation (cherry picked from commit 1967909) # Conflicts: # internal/pkg/otel/translate/output_elasticsearch.go # internal/pkg/otel/translate/output_elasticsearch_test.go * fix merge conflict * fix unit tests --------- Co-authored-by: Lee E Hinman <57081003+leehinman@users.noreply.github.com> Co-authored-by: Lee E. Hinman <lee.e.hinman@elastic.co>
What does this PR do?
Change elasticsearch configuration DecodeHook function to convert a single string to a slice of string with one value if the destination type is a slice of string.
Why is it important?
Beats configs allow for single values when the type is an slice. For example
ssl.certificate_authoritiesis a slice of strings, but beat configuration allows for these to be a string instead of a slice with one entry.Checklist
./changelog/fragmentsusing the changelog toolDisruptive User Impact
How to test this PR locally
Related issues
Questions to ask yourself