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

[exporter] moved mergeBatchFunc and mergeBatchSplitFunc to request #11459

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

sfc-gh-sili
Copy link
Contributor

@sfc-gh-sili sfc-gh-sili commented Oct 16, 2024

Description

This PR changes mergeBatchFunc and mergeBatchSplit function as a member function of batchRequest.

Link to tracking issue

Testing

Documentation

@sfc-gh-sili sfc-gh-sili force-pushed the sili-merge branch 2 times, most recently from 287ad0e to 39122c8 Compare October 17, 2024 09:31
@sfc-gh-sili sfc-gh-sili marked this pull request as ready for review October 17, 2024 09:31
@sfc-gh-sili sfc-gh-sili requested a review from a team as a code owner October 17, 2024 09:31
@sfc-gh-sili sfc-gh-sili changed the title mergeBatchFunc moved to request [exporter] moved mergeBatchFunc and mergeBatchSplitFunc to request Oct 17, 2024
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 89.24731% with 10 lines in your changes missing coverage. Please review.

Project coverage is 91.42%. Comparing base (4dbbb90) to head (3a13329).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
exporter/exporterhelper/internal/request.go 83.63% 7 Missing and 2 partials ⚠️
exporter/exporterhelper/metrics_batch.go 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11459      +/-   ##
==========================================
- Coverage   92.14%   91.42%   -0.72%     
==========================================
  Files         433      433              
  Lines       20389    23658    +3269     
==========================================
+ Hits        18787    21629    +2842     
- Misses       1238     1655     +417     
- Partials      364      374      +10     

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

Comment on lines 30 to 31
Merge(context.Context, BatchRequest) (BatchRequest, error)
MergeSplit(context.Context, exporterbatcher.MaxSizeConfig, BatchRequest) ([]BatchRequest, error)
Copy link
Member

Choose a reason for hiding this comment

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

Please document the functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.

Comment on lines 30 to 31
Merge(context.Context, BatchRequest) (BatchRequest, error)
MergeSplit(context.Context, exporterbatcher.MaxSizeConfig, BatchRequest) ([]BatchRequest, error)
Copy link
Member

Choose a reason for hiding this comment

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

I think (maybe next PR) we can make the second func just Split.

Copy link
Member

@dmitryax dmitryax Oct 18, 2024

Choose a reason for hiding this comment

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

I tried this some time ago. AFAIR there was a performance hit coming from the Merge->Split sequence of calls. But I'd be happy if we can make it work with no problems

Comment on lines 162 to 170
func (req *tracesRequest) Merge(_ context.Context, _ exporterhelper.BatchRequest) (exporterhelper.BatchRequest, error) {
return nil, nil
}

// MergeSplit splits and/or merges the profiles into multiple requests based on the MaxSizeConfig.
func (req *tracesRequest) MergeSplit(_ context.Context, _ exporterbatcher.MaxSizeConfig, _ exporterhelper.BatchRequest) (
[]exporterhelper.BatchRequest, error) {
return nil, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a test where tracesRequest needs the BatchRequest implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree this is confusing. tracesRequest in this file is solely for testing that merging profilesBatchRequest and tracesRequest would fail. Let me rename it to dummyRequest.

}
return bs.sendMergeBatch(ctx, req)
return bs.sendMergeBatch(ctx, req.(internal.BatchRequest))
Copy link
Member

Choose a reason for hiding this comment

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

Custom Request not implementing batching function would panic here. Let's return an error instead?

Copy link
Member

Choose a reason for hiding this comment

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

It is ok for the moment to panic I believe since we are experimental. We will make it required to implement this to setup batching soon.

Copy link
Member

Choose a reason for hiding this comment

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

@sfc-gh-sili for the moment move the functions on Request.

Copy link
Contributor Author

@sfc-gh-sili sfc-gh-sili Oct 18, 2024

Choose a reason for hiding this comment

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

@bogdandrutu Thanks!
Do you mean instead of having Request and BatchRequest, we would like to have Merge() and MergeSplitBatch() as a required function and then just have Request? For users who do not do batching they can leave Merge() and MergeSplit() as noop I assume?

Copy link
Member

Choose a reason for hiding this comment

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

For users who do not do batching they can leave Merge() and MergeSplit() as noop I assume?

Correct.

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.

3 participants