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

Merged
merged 8 commits into from
Oct 21, 2024

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 3 times, most recently from 39122c8 to 6f5643a 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 requested a review from mx-psi 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.41%. Comparing base (5cd035b) to head (bd64227).
Report is 1 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   91.47%   91.41%   -0.07%     
==========================================
  Files         433      433              
  Lines       23616    23657      +41     
==========================================
+ Hits        21603    21625      +22     
- Misses       1645     1658      +13     
- Partials      368      374       +6     

☔ 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 166
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.

@bogdandrutu
Copy link
Member

Please rebase

@bogdandrutu bogdandrutu merged commit 2efeae4 into open-telemetry:main Oct 21, 2024
48 of 49 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 21, 2024
djaglowski pushed a commit to djaglowski/opentelemetry-collector that referenced this pull request Nov 21, 2024
…pen-telemetry#11459)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

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

<!-- Issue number if applicable -->
#### Link to tracking issue

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->
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