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

[processor/transform] Add 'transform.flatten.logs' feature gate #33338

Merged
merged 11 commits into from
Jun 13, 2024

Conversation

djaglowski
Copy link
Member

This PR proposes a feature gate which would enable the Flatten/Unflatten behavior described here.
This was discussed in the Collector SIG recently and it was mentioned that a feature gate would be a reasonable way to implement this.

One immediate question: Should this be purely a feature gate, or should there be a config option on the processor which fails Validate if the feature gate is not set?

@github-actions github-actions bot added cmd/configschema configschema command cmd/otelcontribcol otelcontribcol command connector/datadog exporter/datadog Datadog components processor/transform Transform processor labels Jun 3, 2024
@djaglowski djaglowski force-pushed the transform-flatten-logs branch 2 times, most recently from 3b4063d to 3dc405f Compare June 3, 2024 15:01
@BinaryFissionGames
Copy link
Contributor

BinaryFissionGames commented Jun 3, 2024

I'd advocate for adding in a config option in addition to the feature flag; I think it can help with slowly migrating configs over to this option if needed for more complex configurations. In addition, I think in some scenarios where you don't need the flattened representation, it would be nice to avoid the overhead of having to flatten/unflatten.

It also makes it easier to swap between the hierarchy and flattened representation for agents managed by OpAMP (feature flags are currently treated as static and not configurable through OpAMP, at least in the current supervisor design).

@djaglowski djaglowski force-pushed the transform-flatten-logs branch from 3dc405f to 6033636 Compare June 3, 2024 16:14
@djaglowski djaglowski force-pushed the transform-flatten-logs branch 2 times, most recently from 23d0b3f to 9289d9c Compare June 4, 2024 15:27
@djaglowski djaglowski marked this pull request as ready for review June 4, 2024 15:45
@djaglowski djaglowski requested a review from a team June 4, 2024 15:45
processor/transformprocessor/README.md Show resolved Hide resolved
processor/transformprocessor/config.go Show resolved Hide resolved
processor/transformprocessor/config.go Outdated Show resolved Hide resolved
component: processor/transform

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add `transform.flatten.logs` featuregate to give each log record a distinct resource and scope.
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a note here as well that the config option is also required to enable this? It may be clear enough from the README, so just a suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a note about the config option would also be good in the subtext, just so users hopefully have enough info to use the feature from the changelog entry.

@djaglowski djaglowski force-pushed the transform-flatten-logs branch from 9c8ab4c to f433e36 Compare June 5, 2024 19:04
@TylerHelmuth
Copy link
Member

@djaglowski Can you add a benchmark test for this feature? I know we need it in order to produce the right outcomes for certain scenarios, but I want to be able to claim it is performant when used.

@djaglowski
Copy link
Member Author

I added a simple pair of benchmarks, one with and the other without the flatten option. It's definitely a performance hit but seems reasonable to me for when correctness is needed. Results on my machine:

BenchmarkLogsWithoutFlatten-10    	  389914	      2616 ns/op	     241 B/op	       8 allocs/op
BenchmarkLogsWithFlatten-10       	   63205	     19262 ns/op	    2726 B/op	      53 allocs/op

Copy link
Member

@crobert-1 crobert-1 left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests!

Copy link
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

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

Looks good to me. I think the feature gate is sufficient to get this in despite the early state of the functionality.

processor/transformprocessor/processor_test.go Outdated Show resolved Hide resolved
processor/transformprocessor/processor_test.go Outdated Show resolved Hide resolved
component: processor/transform

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add `transform.flatten.logs` featuregate to give each log record a distinct resource and scope.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a note about the config option would also be good in the subtext, just so users hopefully have enough info to use the feature from the changelog entry.

Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
@TylerHelmuth TylerHelmuth added the ready to merge Code review completed; ready to merge by maintainers label Jun 12, 2024
@evan-bradley evan-bradley merged commit b03a61a into open-telemetry:main Jun 13, 2024
154 checks passed
@github-actions github-actions bot added this to the next release milestone Jun 13, 2024
@djaglowski djaglowski deleted the transform-flatten-logs branch June 13, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd/configschema configschema command cmd/otelcontribcol otelcontribcol command cmd/oteltestbedcol connector/datadog exporter/datadog Datadog components processor/transform Transform processor ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants