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

tetragon: Update eventcache on New() call and cleanup old state #282

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

jrfastab
Copy link
Contributor

@jrfastab jrfastab commented Aug 3, 2022

Currently, if eventcache.New() is called multiple times the old cache
will continue to be used. But, this is problematic if the caller is
trying to configure the cache with new parameters, such as duration
or exporter.

Specifically this is the case in the unit tests where each Test* is
creating a new process manager and exporter using a new file so that
we have specific logs for each test. But, the current behavior means
any events going through the eventcache (after the first test) are
then lossed because they attempt to export into the old filename.

To fix simply stop the old go() on New() and reconfigure it. When
I ran this locally forcing all events through the cache I am now
able to PASS multiple unit tests.

Signed-off-by: John Fastabend [email protected]

Currently, if eventcache.New() is called multiple times the old cache
will continue to be used. But, this is problematic if the caller is
trying to configure the cache with new parameters, such as duration
or exporter.

Specifically this is the case in the unit tests where each Test* is
creating a new process manager and exporter using a new file so that
we have specific logs for each test. But, the current behavior means
any events going through the eventcache (after the first test) are
then lossed because they attempt to export into the old filename.

To fix simply stop the old go() on New() and reconfigure it. When
I ran this locally forcing all events through the cache I am now
able to PASS multiple unit tests.

Signed-off-by: John Fastabend <[email protected]>
@jrfastab jrfastab requested a review from a team as a code owner August 3, 2022 02:33
@jrfastab jrfastab requested a review from olsajiri August 3, 2022 02:33
Copy link
Contributor

@michi-covalent michi-covalent left a comment

Choose a reason for hiding this comment

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

it's probably better to get rid of the package variable cache but it's not directly related to this pr. approved 🚢

@jrfastab jrfastab merged commit 9710289 into main Aug 3, 2022
@jrfastab jrfastab deleted the pr/jrafastab/newEventCache branch August 3, 2022 03:59
@jrfastab
Copy link
Contributor Author

jrfastab commented Aug 3, 2022

Yeah I guess that cache variable has become fairly useless... tbd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants