-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(file sink): supports input based on encoding type #21726
base: master
Are you sure you want to change the base?
Conversation
b400a35
to
2371022
Compare
Hi @nionata, just checking if you wanted a review on this or it's purely a draft for your own purposes. |
Makes sense, no rush 👍 |
4dcbb56
to
8248f8c
Compare
@@ -286,10 +286,36 @@ pub fn random_metrics_with_stream( | |||
batch: Option<BatchNotifier>, | |||
tags: Option<MetricTags>, | |||
) -> (Vec<Event>, impl Stream<Item = EventArray>) { |
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.
This function should perform the exact same for existing callers as the previously hardcoded timestamp params are being passed into the new function
@pront ready for review! |
8248f8c
to
7755dcc
Compare
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.
Thankss @nionata, this looks good! I have only one concern, with this PR we also accept traces. Is it possible to add a basic test for traces as well? Just to make sure we don't falsely advertise trace support. If we find a problem, we can just exclude traces.
src/sinks/file/mod.rs
Outdated
} | ||
|
||
// The TestSerializer only supports Log and Metric data types. This test asserts the current state of running the vector file sink with an event stream. | ||
// A file partition is created and empty lines are written in the file. Running a real vector instance would fail on the configuration because |
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.
"A file partition is created and empty lines are written in the file" - deeming changing the logic to not write a line out of scope here because the top-level config validation should prevent this from happening.
Agreed. Pushed not supported and supported trace tests. |
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 @nionata, this is ready to go. great improvement and I appreciate that you added all these tests 👍
Ah, please add a changelog fragment. See readme and examples here: https://github.com/vectordotdev/vector/tree/master/changelog.d |
Head branch was pushed to by a user without write access
@pront done $ ./scripts/check_changelog_fragments.sh
validating '21704_file_sink_supports_encoding_input.feature.md'
changelog additions are valid. |
Head branch was pushed to by a user without write access
/git/vectordotdev/vector# cargo clippy --all-targets
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.93s |
Summary
The file sink only supports log event input. This PR changes it to support any input that the configured encoding supports.
Change Type
Is this a breaking change?
How did you test this PR?
Cargo test
I added single and multi-partition tests to the file sink tests module. I added a
log_
prefix to all the existing tests to disambiguate between the newmetric_
tests. I did not add a compression or reopening test for metrics input as it should be handled by the log tests.The full test suite passes
Manual
Before
After
Validation still catches when the encoding type does not support the input type
Does this PR include user facing changes?
Checklist
Cargo.lock
), pleaserun
dd-rust-license-tool write
to regenerate the license inventory and commit the changes (if any). More details here.References
closes #21704