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

[chore][pkg/stanza/fileconsumer] Remove notion of generation from readers #27396

Closed

Conversation

djaglowski
Copy link
Member

The idea behind generations was to allow us some memory of previously known files, but also to forget them eventually so that we do not grow memory indefinitely.

This PR removes the notion of generation from the reader struct. Instead, the Manager struct keeps a fixed slice of knownFiles with a capacity of 10 * max_concurrent_files. This size is somewhat arbitrary and could be made configurable in the future. However, we are trading one arbitrary & unexposed limitation for another in order to isolate the responsibilities of the reader struct independent. This should allow us to move the struct into a dedicated package which can then be hardened.

@djaglowski djaglowski added the Run Windows Enable running windows test on a PR label Oct 2, 2023
@djaglowski djaglowski force-pushed the pkg-stanza-rm-generations branch from 3eab8c3 to 99c8246 Compare October 2, 2023 21:30
@djaglowski djaglowski marked this pull request as ready for review October 2, 2023 21:53
@djaglowski djaglowski requested review from a team and jpkrohling October 2, 2023 21:53
@djaglowski
Copy link
Member Author

@VihasMakwana, I'd appreciate your review on this. Removing this field should allow us to further simplify the fileconsumer package.

@VihasMakwana
Copy link
Contributor

@djaglowski many thanks for this change! It relieves the complexity

@djaglowski djaglowski force-pushed the pkg-stanza-rm-generations branch from 99c8246 to 72e90b6 Compare October 3, 2023 12:30
djaglowski added a commit that referenced this pull request Oct 4, 2023
…age (#27416)

Follows #27396 

This PR creates an internal `reader` package and moves directly related
structs into it.

I intend to clean up this codebase substantially from here. This is just
a first step that creates a crude boundary between concerns. There are
many exported fields which can later be abstracted, but currently the
codebase has many direct interactions. Tests remain in the
`fileconsumer` package for now but will be migrated once there are
cleaner interfaces to test.
@djaglowski djaglowski closed this Oct 4, 2023
@djaglowski djaglowski force-pushed the pkg-stanza-rm-generations branch from 72e90b6 to 5dba9aa Compare October 4, 2023 00:21
@djaglowski
Copy link
Member Author

Merged as part of #27416

@djaglowski djaglowski deleted the pkg-stanza-rm-generations branch October 4, 2023 00:23
jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this pull request Nov 12, 2023
…age (open-telemetry#27416)

Follows open-telemetry#27396 

This PR creates an internal `reader` package and moves directly related
structs into it.

I intend to clean up this codebase substantially from here. This is just
a first step that creates a crude boundary between concerns. There are
many exported fields which can later be abstracted, but currently the
codebase has many direct interactions. Tests remain in the
`fileconsumer` package for now but will be migrated once there are
cleaner interfaces to test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/stanza Run Windows Enable running windows test on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants