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

[extension/memorylimiter] add memory limiter extension, a copy of memorylimiter processor #8964

Merged
merged 12 commits into from
Jan 23, 2024

Conversation

timannguyen
Copy link
Contributor

@timannguyen timannguyen commented Nov 20, 2023

Description:

following #8632, this change is to move memory limiter to being an extension. This allows us to place the component to reject incoming connections due to limited memory, providing better protection to the otel collector.

missing feature: receiver fairness. issue where a receiver hogs all the resource can happen.

Link to tracking Issue:
#8632

Testing:
unit test

Documentation:

README.md

@timannguyen timannguyen requested review from a team and codeboten November 20, 2023 21:07
@timannguyen timannguyen changed the title add memory limiter extension, a copy of memorylimiter processor [extension/memorylimiter] add memory limiter extension, a copy of memorylimiter processor Nov 20, 2023
@timannguyen timannguyen force-pushed the memlimiter branch 3 times, most recently from 09200a7 to 5b2cbf2 Compare November 20, 2023 21:27
@splunkericl
Copy link
Contributor

  • Can you outline how the extension can be used in http server? I didn't see a specific interface to use it.
  • A lot of codes are just copying. Will the refactor come in a different MR?

@timannguyen
Copy link
Contributor Author

@mx-psi will you take a look?

@timannguyen
Copy link
Contributor Author

@splunkericl impl of httlp interceptor a9f24a1

Copy link
Contributor

@splunkericl splunkericl left a comment

Choose a reason for hiding this comment

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

LGTM. waiting for maintainers to take a look

@timannguyen
Copy link
Contributor Author

going to follow up with PRs after this:

  • adding the extension to http and grpc
  • support balancing between multiple receivers if they were to use the same extension
  • post some notice in memorylimiterprocessor that this is an alternative?

@timannguyen timannguyen force-pushed the memlimiter branch 2 times, most recently from 85d0022 to 1f2204d Compare November 27, 2023 15:54
@mx-psi
Copy link
Member

mx-psi commented Nov 28, 2023

@timannguyen Thanks for raising this PR and apologies for not replying sooner. Since this is a new component, would you mind bringing this up to the Collector SIG weekly meeting? It happens on Wednesdays at 09:00 PT

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

Attention: 40 lines in your changes are missing coverage. Please review.

Comparison is base (34b6544) 90.35% compared to head (3dd4816) 90.22%.

Files Patch % Lines
internal/memorylimiter/memorylimiter.go 76.59% 26 Missing and 7 partials ⚠️
...terextension/internal/metadata/generated_status.go 0.00% 4 Missing ⚠️
extension/memorylimiterextension/memorylimiter.go 75.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8964      +/-   ##
==========================================
- Coverage   90.35%   90.22%   -0.13%     
==========================================
  Files         339      343       +4     
  Lines       17965    18003      +38     
==========================================
+ Hits        16232    16244      +12     
- Misses       1409     1430      +21     
- Partials      324      329       +5     

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

@timannguyen
Copy link
Contributor Author

@mx-psi is there a link to the meeting? I can make it.

@mx-psi
Copy link
Member

mx-psi commented Nov 29, 2023

@mx-psi is there a link to the meeting? I can make it.

@timannguyen Sure! Here are the meeting notes that include the Zoom link https://docs.google.com/document/d/1r2JC5MB7GupCE7N32EwGEXs9V_YIsPgoFiLP4VWVMkE/edit Please add this as an item for the agenda :)

@timannguyen
Copy link
Contributor Author

updated impl of http and grpc timannguyen@e84fa98

@timannguyen
Copy link
Contributor Author

@dmitryax will you take a look whenever you have a chance?

@timannguyen timannguyen force-pushed the memlimiter branch 3 times, most recently from c4a9038 to 3314255 Compare December 8, 2023 18:36
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.

@timannguyen can you please move the shared code to internal/memorylimiter and reuse it instead of copying?

extension/memorylimiter/memorylimiter.go Outdated Show resolved Hide resolved
@timannguyen
Copy link
Contributor Author

@dmitryax i did the refactoring. let me know how it is

processor/memorylimiterprocessor/memorylimiter.go Outdated Show resolved Hide resolved
processor/memorylimiterprocessor/config.go Show resolved Hide resolved
processor/memorylimiterprocessor/memorylimiter.go Outdated Show resolved Hide resolved
internal/memorylimiter/memorylimiter.go Outdated Show resolved Hide resolved
@timannguyen timannguyen force-pushed the memlimiter branch 3 times, most recently from 64417da to 043aae3 Compare January 16, 2024 20:50
@timannguyen
Copy link
Contributor Author

cant quite replicate make genotelcorecol to what github has. mirrored what is in main instead.

@timannguyen timannguyen force-pushed the memlimiter branch 5 times, most recently from 278c4ba to 91c75cc Compare January 17, 2024 21:53
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.

LGTM. @mx-psi PTAL as well

the collector. The extension will potentially replace the Memory Limiter Processor.
It provides better guarantees from running out of memory as it will be used by the
receivers to reject requests before converting them into OTLP. All the configurations
are the same as Memory Limiter Processor. The extension is under development and does nothing.
Copy link
Member

Choose a reason for hiding this comment

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

Can you add what's the strategy for the future? How would this extension interact with the pipeline? Would receivers need to do anything at all to take advantage of this?

Copy link
Member

Choose a reason for hiding this comment

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

@jpkrohling, this is not well-defined yet. I have some ideas. I can put them in a doc or an issue and bring it for discussion. I believe this can be done as a follow-up and we can merge this PR to make it available for playing. The new component is in development stability and is not expected to be used in prod anyway. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Most of the information I'm looking for is already part of the github issue, but I think the design should be clear by looking at the component alone (readme and examples). That said, it's certainly OK to have it done in a follow-up PR.

@dmitryax dmitryax merged commit a85b37d into open-telemetry:main Jan 23, 2024
31 of 32 checks passed
@github-actions github-actions bot added this to the next release milestone Jan 23, 2024
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.

6 participants