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

add support for deleting expired aggregates #178

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

eranra
Copy link
Collaborator

@eranra eranra commented Apr 10, 2022

No description provided.

@eranra eranra linked an issue Apr 10, 2022 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Apr 10, 2022

Codecov Report

Merging #178 (77ea806) into main (a1d72e8) will increase coverage by 0.61%.
The diff coverage is 92.06%.

@@            Coverage Diff             @@
##             main     #178      +/-   ##
==========================================
+ Coverage   57.86%   58.48%   +0.61%     
==========================================
  Files          58       58              
  Lines        3318     3365      +47     
==========================================
+ Hits         1920     1968      +48     
+ Misses       1270     1268       -2     
- Partials      128      129       +1     
Flag Coverage Δ
unittests 58.48% <92.06%> (+0.61%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/pipeline/extract/aggregate/aggregate.go 93.95% <89.65%> (-1.13%) ⬇️
pkg/pipeline/extract/aggregate/aggregates.go 90.90% <94.11%> (+16.62%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1d72e8...77ea806. Read the comment docs.

pkg/pipeline/extract/aggregate/aggregate.go Outdated Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregate_test.go Outdated Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregates.go Outdated Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregates.go Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregates.go Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregates.go Outdated Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregates_test.go Outdated Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregates_test.go Outdated Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregate.go Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregates.go Outdated Show resolved Hide resolved
pkg/pipeline/extract/aggregate/aggregate.go Show resolved Hide resolved
@eranra eranra merged commit 6eea033 into netobserv:main Apr 14, 2022
Comment on lines +95 to +97
aggregate.mutex.Lock()
aggregate.cleanupExpiredEntries()
aggregate.mutex.Unlock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to move the Lock()/Unlock() inside aggregate.cleanupExpiredEntries() as done in GetMetrics() and UpdateByEntry()

Comment on lines +72 to +75
time.Sleep(2 * time.Second) // still exists after 2 seconds
require.Equal(t, 1, len(aggregates.Aggregates[0].GetMetrics()))
time.Sleep(3 * time.Second) // expires after 3 more seconds (5 seconds in total)
require.Equal(t, 0, len(aggregates.Aggregates[0].GetMetrics()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good comments

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.

Aggregate: cleanup aggregates
4 participants