[exporter/file] Omit length-prefix framing for stream-decodable encodings when native compression is enabled#49384
Draft
paulojmdias wants to merge 6 commits into
Draft
[exporter/file] Omit length-prefix framing for stream-decodable encodings when native compression is enabled#49384paulojmdias wants to merge 6 commits into
paulojmdias wants to merge 6 commits into
Conversation
…ings when native compression is enabled, producing clean text output Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the fileexporter native-compression path to avoid 4-byte length-prefix framing for stream-decodable log encodings (e.g., text_encoding), so decompressed .zst output is clean, newline-delimited text suitable for standard tooling.
Changes:
- Thread an
encodingUnframedcapability from the selected encoding extension into the file writer’s framing selection underexporter.file.nativeCompression. - Adjust native-compression framing selection to use newline-delimited output for eligible encodings (and keep length-prefix framing for proto/other encodings).
- Add unit tests validating unframed/newline-delimited behavior for stream-decodable encodings, plus documentation and changelog updates.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| exporter/fileexporter/file_writer.go | Adds encodingUnframed parameter to framing selection to choose newline-delimited output under native compression. |
| exporter/fileexporter/marshaller.go | Detects stream-decodable encoding extensions (via encoding.LogsDecoderFactory) and records the capability. |
| exporter/fileexporter/file_exporter.go | Passes encodingUnframed into framing selection for the standard exporter. |
| exporter/fileexporter/grouping_file_exporter.go | Passes encodingUnframed into framing selection for the grouping exporter. |
| exporter/fileexporter/native_compression_test.go | Adds tests validating unframed behavior for stream-decodable encodings and framing toggle behavior. |
| exporter/fileexporter/file_exporter_test.go | Updates tests for the new buildExportFunc signature. |
| exporter/fileexporter/README.md | Documents newline-delimited output for JSON and stream-decodable encodings under native compression. |
| exporter/fileexporter/go.mod | Promotes extension/encoding to a direct dependency due to new imports. |
| .chloggen/fileexporter-unframed-text-encoding.yaml | Changelog entry for the framing behavior change under the feature gate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…-contrib into fix/49328 Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
…ector-contrib into fix/49328 Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Under the
exporter.file.nativeCompressionfeature gate, output from a customencodingextension was always length-prefixed (exportMessageAsBuffer), sotext_encodingfiles decompressed to a 4-byte prefix + text instead of clean text. Now, encodings that are stream-decodable on read-back (implementencoding.LogsDecoderFactory, e.g.,text_encoding) are written in newline-delimited format. Proto and other encodings keep length-prefix framing.Link to tracking issue
Fixes #49328
Testing
Added unit tests: stream-decodable encoding yields clean newline-delimited output (no prefix), and verified end-to-end with
text_encoding+ zstd + the gate, andzstdcatoutput is now clean text.Documentation
Updated native-compression note.
Authorship