-
Notifications
You must be signed in to change notification settings - Fork 41
feat(recombine): add combine_with
option
#315
feat(recombine): add combine_with
option
#315
Conversation
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.
🚀
Codecov Report
@@ Coverage Diff @@
## main #315 +/- ##
=====================================
Coverage 77.0% 77.0%
=====================================
Files 94 94
Lines 4408 4410 +2
=====================================
+ Hits 3395 3397 +2
Misses 697 697
Partials 316 316
|
@astencel-sumo This is a great improvement and I am fully in support of it. That said, I think that we should have a test or two that demonstrate the configuration as it is read from an actual file, so that we can be sure there are not issues with the way a user would represent a newline character or any other character. Would you mind adding a couple golden config tests to demonstrate the way a user would configure this? |
Thanks @djaglowski for pointing this out, will add the config tests. Please not that for those to work, I will need this change: #317. Without it, I'm getting this failure:
|
@djaglowski See my commit with config tests 8864cae. |
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.
Thanks for adding those config tests @astencel-sumo. Just one doc nit.
docs/operators/recombine.md
Outdated
@@ -11,9 +11,10 @@ The `recombine` operator combines consecutive logs into single logs based on sim | |||
| `on_error` | `send` | The behavior of the operator if it encounters an error. See [on_error](/docs/types/on_error.md). | | |||
| `is_first_entry` | | An [expression](/docs/types/expression.md) that returns true if the entry being processed is the first entry in a multiline series. | | |||
| `is_last_entry` | | An [expression](/docs/types/expression.md) that returns true if the entry being processed is the last entry in a multiline series. | | |||
| `combine_field` | required | The [field](/docs/types/field.md) from all the entries that will recombined with newlines. | | |||
| `combine_field` | required | The [field](/docs/types/field.md) from all the entries that will recombined. | | |||
| `combine_with` | `\n` | The string that is put between the combined entries. This can be an empty string as well. | |
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.
Nit - since a user should expect different results based on whether or not this value is quoted, I think we need to be precise here. Specifically, the user would have to specify "\n"
in order to replicate the default behavior, so I think we should show that exact value here.
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.
Yes I fully agree, we should be explicit about the types of the values.
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.
Typically, it doesn't matter if the user writes "foo"
or foo
. When read, the value becomes the same either way.
In this case, it does matter whether the user writes "\n"
or \n
. I think it is enough to show the value here that is actually interpreted the same as the default value.
| `combine_with` | `\n` | The string that is put between the combined entries. This can be an empty string as well. | | |
| `combine_with` | `"\n"` | The string that is put between the combined entries. This can be an empty string as well. | |
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.
Fixed in 649bfc8.
Also updated examples in the docs, please take a look @djaglowski.
This adds a basic test plus tests for the new `combine_with` option.
The CRI example was assuming the 'P' entries are separate lines, which is incorrect - the entries are part of a single long line and should be merged without the newlines in between.
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.
Thanks for the contribution @astencel-sumo. This is very nice improvement.
Any plans for a new release @djaglowski? I'd like to use it in OTC's filelog receiver. This change should probably also go into the Changelog, shouldn't it? |
Yes, it should go in the changelog. I'll make a PR to prep the changelog for the release, and will cut a release as soon as that's merged, most likely can be today. |
- `combine_with` setting to `recombine` operator, to allow for joining on custom delimiter ([PR315](open-telemetry#315)) - Issue where `force_flush_period` could cause line splitting to be skipped ([PR303](open-telemetry#303)) - Issue where `tcp_input` and `udp_input` could panic when stopping ([PR273](open-telemetry#273)) - Syslog severity mapping is now aligned with log specification ([PR300](open-telemetry#300)) - Improve error message when timezone database is not found ([PR289](open-telemetry#289))
- `combine_with` setting to `recombine` operator, to allow for joining on custom delimiter ([PR315](#315)) - Issue where `force_flush_period` could cause line splitting to be skipped ([PR303](#303)) - Issue where `tcp_input` and `udp_input` could panic when stopping ([PR273](#273)) - Syslog severity mapping is now aligned with log specification ([PR300](#300)) - Improve error message when timezone database is not found ([PR289](#289))
Fixes #314