-
Notifications
You must be signed in to change notification settings - Fork 42
Conversation
Codecov Report
@@ Coverage Diff @@
## main #307 +/- ##
=======================================
+ Coverage 77.1% 77.4% +0.2%
=======================================
Files 94 95 +1
Lines 4471 4528 +57
=======================================
+ Hits 3451 3506 +55
- Misses 701 702 +1
- Partials 319 320 +1
|
parsed := make(map[string]interface{}) | ||
|
||
var err error | ||
for _, raw := range splitStringByWhitespace(input) { |
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.
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.
Done. The operator now takes a func(input string) []string
for splitting the input string. By default, it will split on whitespace, if the user provides a character or substring, stirngs.Split()
is used.
docs/operators/key_value_parser.md
Outdated
| `parse_from` | $ | A [field](/docs/types/field.md) that indicates the field to be parsed into key value pairs | | ||
| `parse_to` | $ | A [field](/docs/types/field.md) that indicates the field to be parsed as into key value pairs | |
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.
The library technically still interprets $
as $body
, but we've gotten away from documenting it this way. Better to be clear.
docs/operators/key_value_parser.md
Outdated
|
||
### Configuration Fields | ||
|
||
| Field | Default | Description | |
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: To be consistent with other docs, can you add punctuation to the descriptions.
return &KVParserConfig{ | ||
ParserConfig: helper.NewParserConfig(operatorID, "key_value_parser"), | ||
Delimiter: "=", | ||
PairDelimiter: "", |
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.
PairDelimiter: "", |
Since this is the zero value for any string, not needed unless it adds clarity, but I don't think it does.
key := cleanString(m[0]) | ||
value := cleanString(m[1]) | ||
|
||
// TODO: Check if key already exists and fail if so? |
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.
Failing entirely seems harsh. Probably a lot better to get a partial log than none.
We could alternately log the error. Not sure the performance hit of checking every time is worth it for the rare case when it matters though.
Up to you, but we should decide and remove the TODO.
@@ -0,0 +1 @@ | |||
type: key_value_parser |
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.
type: key_value_parser | |
type: key_value_parser | |
@@ -0,0 +1,2 @@ | |||
type: key_value_parser | |||
delimiter: ";" |
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.
delimiter: ";" | |
delimiter: ";" | |
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.
We're not consistent on this in this library, but we need to move in that direction.
Overall this looks good to me. Just a few minor cleanup things. |
This test is meant to ensure that partial logs are flushed on an interval if they are not 'completed'. The test appears to have too unforgiving a margin when ensuring that the timeout is not applied too soon.
…pen-telemetry#356) Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.0. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](onsi/gomega@v1.17.0...v1.18.0) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.23.2 to 0.23.3. - [Release notes](https://github.com/kubernetes/client-go/releases) - [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md) - [Commits](kubernetes/client-go@v0.23.2...v0.23.3) --- updated-dependencies: - dependency-name: k8s.io/client-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…pen-telemetry#363) Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.18.0 to 1.18.1. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](onsi/gomega@v1.18.0...v1.18.1) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…try#361) Bumps [go.opentelemetry.io/collector](https://github.com/open-telemetry/opentelemetry-collector) from 0.42.0 to 0.43.1. - [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG.md) - [Commits](open-telemetry/opentelemetry-collector@v0.42.0...v0.43.1) --- updated-dependencies: - dependency-name: go.opentelemetry.io/collector dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…etry#362) Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](golangci/golangci-lint@v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
) Bumps [github.com/securego/gosec/v2](https://github.com/securego/gosec) from 2.9.6 to 2.10.0. - [Release notes](https://github.com/securego/gosec/releases) - [Changelog](https://github.com/securego/gosec/blob/master/.goreleaser.yml) - [Commits](securego/gosec@v2.9.6...v2.10.0) --- updated-dependencies: - dependency-name: github.com/securego/gosec/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…hes line (open-telemetry#416) * feat(operator/recombine): do not combine logs before first_entry matches line Signed-off-by: Dominik Rosiek <[email protected]>
…try#422) Bumps [go.opentelemetry.io/collector](https://github.com/open-telemetry/opentelemetry-collector) from 0.45.0 to 0.46.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG.md) - [Commits](open-telemetry/opentelemetry-collector@v0.45.0...v0.46.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/collector dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add support for parsing multiline csv records The csv parser previously was unable to properly handle multiline values. This change adds support. Newlines within csv records are preserved.
Several tools were required by this repo but not actually used.
This was a vestigial feature and can be removed without any impact.
* Bump gonum to resolve iteration issue in Go 1.18 * Update changelog for immediate patch
* Revert version of syslog-go * chlog
) Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.7.0...v1.7.1) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…etry#442) Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.44.2 to 1.45.0. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](golangci/golangci-lint@v1.44.2...v1.45.0) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…etry#434) * feat(helpers/multiline): add test for flusher if multiple logs in buffer Signed-off-by: Dominik Rosiek <[email protected]> * refactor(helpers/multiline): refactor flusher due to bug Signed-off-by: Dominik Rosiek <[email protected]> * feat(helpers/multiline): add more tests and fixes for multiline Signed-off-by: Dominik Rosiek <[email protected]> * feat(helpers/multiline): add more tests and fixes for multiline Signed-off-by: Dominik Rosiek <[email protected]> * refactor(helpers/multiline): add flushed function to forceFlusher Signed-off-by: Dominik Rosiek <[email protected]> * refactor(helpers/multiline): wrap splitFuncs with force flusher splitFunc to simplify logic Signed-off-by: Dominik Rosiek <[email protected]> * tests(helpers/multiline): unify force flusher starting data length Signed-off-by: Dominik Rosiek <[email protected]> * feat(helpers/multiline): do not flush empty log Signed-off-by: Dominik Rosiek <[email protected]> * tests(helpers/multiline): do not overengineer tests Signed-off-by: Dominik Rosiek <[email protected]> * feat(helpers/multiline): remove enable force flushing Signed-off-by: Dominik Rosiek <[email protected]> * refactor(helpers/multiline): remove NewFlusher function Signed-off-by: Dominik Rosiek <[email protected]> * refactor(helpers/multiline): flatter flusherSplitFunc Signed-off-by: Dominik Rosiek <[email protected]> * refactor(helpers/multiline): extract force flusher related function from flusherSplitFunc Signed-off-by: Dominik Rosiek <[email protected]> * refactor(helpers/multiline): remove splitFuncWrapper Signed-off-by: Dominik Rosiek <[email protected]> * tests(helpers/multiline): do not return empty log for NewNewlineSplitFunc Signed-off-by: Dominik Rosiek <[email protected]> * chore(helpers/multiline): add comment Signed-off-by: Dominik Rosiek <[email protected]> * refactor(helpers/multiline): revert not necessary needed change Signed-off-by: Dominik Rosiek <[email protected]>
* Remove '$' from field syntax * Enforce rule that body fields must start with 'body'
This operator assumes that resource and attributes are flat maps. The add operator has made it redundant anyways.
* Enforce maximum SD-NAME length of 32, per RFC5424 Longer SD-NAMEs were previously allowed in fork of go-syslog dependency, but it is not clear that this is necessary.
…ry#430) * Add changelog entry for major set of breaking changes.
…lace existing value in the rare case that it already exists
See #459