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

[config/confighttp] add memorylimiterextension to confighttp #9397

Closed
wants to merge 2 commits into from

Conversation

timannguyen
Copy link
Contributor

@timannguyen timannguyen commented Jan 25, 2024

Description:

integrate MemoryLimiterExtension with confighttp. The line of thinking is if there is a limiter extension all http servers would be restricted based on that memory requirement in order to not crash the collector from OOM.

Link to tracking Issue: 8632

Testing:

unit test

Documentation:

confighttp README linking to memorylimiterextension.

@timannguyen timannguyen requested review from a team and Aneurysm9 January 25, 2024 15:50
@timannguyen timannguyen changed the title add memorylimiterextension to confighttp [config/confighttp] add memorylimiterextension to confighttp Jan 25, 2024
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.91%. Comparing base (420772e) to head (960c5a2).
Report is 191 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9397      +/-   ##
==========================================
- Coverage   90.93%   90.91%   -0.02%     
==========================================
  Files         348      348              
  Lines       18379    18399      +20     
==========================================
+ Hits        16713    16728      +15     
- Misses       1344     1348       +4     
- Partials      322      323       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

config/confighttp/confighttp.go Outdated Show resolved Hide resolved
config/confighttp/confighttp.go Outdated Show resolved Hide resolved
@dmitryax
Copy link
Member

I'm not sure that silently applying any available memory_limiter extension is the right approach to start. What if I want some receivers to be more aggressive in rejecting based on memory utilization than others? There must be a way to configure that even if we allow the behavior defined in this PR. To avoid introducing breaking changes going forward, we need to design the user interface before applying this change.

@timannguyen timannguyen force-pushed the http_memlimit branch 2 times, most recently from c3d1ec7 to 7691c98 Compare January 26, 2024 16:06
@splunkericl
Copy link
Contributor

splunkericl commented Jan 26, 2024

I'm not sure that silently applying any available memory_limiter extension is the right approach to start. What if I want some receivers to be more aggressive in rejecting based on memory utilization than others? There must be a way to configure that even if we allow the behavior defined in this PR. To avoid introducing breaking changes going forward, we need to design the user interface before applying this change.

Yeah I think what we can do is simulate how Auth is handled in confighttp. We can add a component ID in HTTPServerSettings for rate(memory) limiting components and only load it if users specify it.

@timannguyen timannguyen force-pushed the http_memlimit branch 2 times, most recently from 97e6f04 to a87cc5f Compare January 29, 2024 19:54
@timannguyen
Copy link
Contributor Author

@dmitryax updated to only add the extension to the struct. nonfunctional.

config/confighttp/confighttp.go Outdated Show resolved Hide resolved
extension/memorylimiterextension/memorylimiter.go Outdated Show resolved Hide resolved
@timannguyen timannguyen force-pushed the http_memlimit branch 2 times, most recently from 021512f to 579c4a0 Compare February 1, 2024 20:56
config/confighttp/confighttp.go Outdated Show resolved Hide resolved
extension/memorylimiterextension/memorylimiter.go Outdated Show resolved Hide resolved
config/confighttp/confighttp_test.go Show resolved Hide resolved
config/confighttp/README.md Outdated Show resolved Hide resolved
Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

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

Couple nits. Otherwise LGTM

Comment on lines 80 to 81

`memory_limiter`: [Memory limiter extension](../../extension/memorylimiterextension/README.md) that will reject incoming requests once the memory utilization grows above configured limits.
Copy link
Member

Choose a reason for hiding this comment

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

Please keep it as another option in the list

Suggested change
`memory_limiter`: [Memory limiter extension](../../extension/memorylimiterextension/README.md) that will reject incoming requests once the memory utilization grows above configured limits.
- `memory_limiter`: [Memory limiter extension](../../extension/memorylimiterextension/README.md) that will reject incoming requests once the memory utilization grows above configured limits.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if hss.MemoryLimiter != nil {
ml, err := getMemoryLimiterExtension(hss.MemoryLimiter, host.GetExtensions())
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

Please cover this path to make codecov happy. Should be easy I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

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

covered

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added Stale and removed Stale labels Mar 20, 2024
Copy link
Contributor

github-actions bot commented Apr 4, 2024

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added Stale and removed Stale labels Apr 4, 2024
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Apr 20, 2024
Copy link
Contributor

github-actions bot commented May 8, 2024

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants