-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[receiver/filelog] Implement ExcludeOlderThan
matcher criterion
#31916
[receiver/filelog] Implement ExcludeOlderThan
matcher criterion
#31916
Conversation
6d99e99
to
57819c0
Compare
7ee2a2e
to
e802024
Compare
Please address CI failures |
Ugh, I had a bad merge which resulted in a lot of files being changed and lots of labels and reviewers being added to this PR. I've sinced fixed the commits but the labels and reviewers remain. Sorry about that. 😞 @djaglowski should I close this PR and open a new one or do you want to remove the unrelated labels and reviewers from this PR? |
I have a use case which is similar to this where i want to do
If your change gets merged, and we set both exclude_older_than: 1h
ordering_criteria:
top_n: 3
sort_by:
- sort_type: mtime will it work as described above? |
fileMTimes: []time.Time{twoHoursAgo, threeHoursAgo}, | ||
excludeOlderThan: 3 * time.Hour, |
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 can be a followup PR but I think the test is set up a bit strange here because we're comparing "exactly 3 hours" to "3 hour + trivial time" (because we initialize threeHoursAgo
above and compare it just a few cycles later.) I think we should instead make this an unambiguous comparison and consider ways to test the exactly equal case.
…en-telemetry#31916) **Description:** This PR implements a new matcher criterion in the Stanza fileconsumer matcher: ``` ExcludeOlderThan time.Duration `mapstructure:"exclude_older_than"` ``` and the corresponding setting in the `filelog` receiver configuration: | Field | Default | Description | |-------------------------------------|--------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `exclude_older_than` | | Exclude files whose modification time is older than the specified age. | When specified, the matcher will exclude files whose modification times are older than the specified time. **Link to tracking Issue:** open-telemetry#31053 **Testing:** Added unit tests. **Documentation:** Documented `exclude_older_than` configuration setting in the `filelogreceiver`'s README. --------- Co-authored-by: Daniel Jaglowski <[email protected]>
Description:
This PR implements a new matcher criterion in the Stanza fileconsumer matcher:
and the corresponding setting in the
filelog
receiver configuration:exclude_older_than
When specified, the matcher will exclude files whose modification times are older than the specified time.
Link to tracking Issue: #31053
Testing: Added unit tests.
Documentation: Documented
exclude_older_than
configuration setting in thefilelogreceiver
's README.