Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add marshal processor #1830

Merged
merged 52 commits into from
Sep 13, 2024
Merged

Add marshal processor #1830

merged 52 commits into from
Sep 13, 2024

Conversation

kuiperda
Copy link
Contributor

Proposed Change

Add first iteration of Marshal processor to our Agent. (Formerly "Serialize Processor").

The intent is to allow sending data to security platforms that do their own parsing and do not want the body to be in OTLP format. Currently these use cases cannot easily use Bindplane for data reduction on those logs since they must retain the original format.

This processor supports marshaling to JSON and KV.

XML support is going to be through an OTTL function that is being submitted to OTEL by Sam H.

This processor makes assumptions about the format of the body. For now we are going to expect users to parse and flatten body fields correctly before using this processor.

This is an initial draft that I expect to iterate on, but wanted to open it up for feedback.

Checklist
  • Changes are tested
  • CI has passed

@kuiperda kuiperda force-pushed the add-marshal-processor branch from 6b62c13 to 8bb9fb6 Compare August 30, 2024 14:44
processor/marshalprocessor/processor.go Outdated Show resolved Hide resolved
processor/marshalprocessor/processor.go Outdated Show resolved Hide resolved
processor/marshalprocessor/config.go Outdated Show resolved Hide resolved
processor/marshalprocessor/factory.go Outdated Show resolved Hide resolved
processor/marshalprocessor/processor_test.go Outdated Show resolved Hide resolved
processor/marshalprocessor/processor.go Outdated Show resolved Hide resolved
@kuiperda
Copy link
Contributor Author

@BinaryFissionGames This is ready for re-review when you have some time. Thanks!

Copy link
Contributor

@BinaryFissionGames BinaryFissionGames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing I see in the README, otherwise this is looking great to me.

processor/marshalprocessor/README.md Outdated Show resolved Hide resolved
@kuiperda
Copy link
Contributor Author

Thanks for the thorough review on this, it is much improved from where it started.

@kuiperda kuiperda merged commit 8f64012 into release/v1.60.0 Sep 13, 2024
15 checks passed
@kuiperda kuiperda deleted the add-marshal-processor branch September 13, 2024 13:43
dpaasman00 pushed a commit that referenced this pull request Sep 17, 2024
* add factory

* add config

* add testdata

* processor test and other files

* processor.go mvp

* rename module

* add processors.go

* add readme

* update go.mod replace

* run make fmt

* lint

* lint 2.0

* Skip processing unless body is a map

* convert map to kv directly

* do not allow configuring xml

* Add metadata.yaml

* Update go.mod and rest of metadata

* fmt and lint

* fix factory_test

* log instead of erroring when log type is not map

* use golden and comparelogs

* run go mod tidy at top leve;
l

* add kv separators to config

* rename testdata fileds

* cover cases for KV marshaling

* rename separator and pair separator properly

* update readme with kv separators

* go mod tidy + go generate + make fmt

* handle nested maps for kv

* handle deeply nested logs for kv that also contain problematic characters

* go mod tidy + go generate + make fmt

* include fuller pipeline for config examples

* rename headers

* remove XML references in readme

* set default config parameters in config

* update go mod

* add config defaults to factory test

* convert string in newMarshalProcessor

* use backticks

* do not repeatedly fmt.Sprintf(v)

* use recursive function

* add map kv separators in config options

* add processor tests for mapkvseparators

* allow specifying map kv separators

* go generate + make fmt

* lint

* sort by keys

* update readme

* add test to confirm behavior of nested slices with KV marshaling

* add array expectation to readme

* fix case of config options
@kuiperda kuiperda mentioned this pull request Nov 6, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants