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

sdk/log/logtest: Add RecordBuilder #5234

Closed
wants to merge 20 commits into from

Conversation

pellared
Copy link
Member

@pellared pellared commented Apr 19, 2024

Fixes #5192.

My goal was to design the builder in a way to make it as much usable for exporter and processor testing as possible.

See test example for usage.

See also alternative design: #5258

Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 92.40506% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 84.6%. Comparing base (ae55e29) to head (0b9cb31).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #5234   +/-   ##
=====================================
  Coverage   84.6%   84.6%           
=====================================
  Files        258     259    +1     
  Lines      17349   17428   +79     
=====================================
+ Hits       14678   14749   +71     
- Misses      2360    2368    +8     
  Partials     311     311           
Files Coverage Δ
sdk/log/logtest/builder.go 92.4% <92.4%> (ø)

... and 1 file with indirect coverage changes

@pellared pellared added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 19, 2024
@pellared pellared changed the title [Spike] sdk/log/logtest: Add RecordBuilder [Spike] sdk/log/logtest: Add Builder Apr 19, 2024
Copy link
Member

@XSAM XSAM left a comment

Choose a reason for hiding this comment

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

I do not have a strong opinion on my comments.

sdk/log/logtest/builder.go Outdated Show resolved Hide resolved
}

// TODO: comment.
func (b Builder) Record() sdklog.Record {
Copy link
Member

@XSAM XSAM Apr 21, 2024

Choose a reason for hiding this comment

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

Suggested change
func (b Builder) Record() sdklog.Record {
func (b Builder) Build() sdklog.Record {

Builder builds. However, golang uses String for strings.Builder.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is why I decided to name it Record to follow the strings.Builder

@pellared pellared changed the title [Spike] sdk/log/logtest: Add Builder [WIP] sdk/log/logtest: Add Builder Apr 22, 2024
@pellared
Copy link
Member Author

Making it an "actual PR" (not just a spike) based on initial feedback.

@pellared pellared marked this pull request as draft April 22, 2024 09:10
@pellared pellared changed the title [WIP] sdk/log/logtest: Add Builder [WIP] sdk/log/logtest: Add RecordBuilder Apr 22, 2024
@pellared pellared removed the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 22, 2024
@pellared pellared changed the title [WIP] sdk/log/logtest: Add RecordBuilder sdk/log/logtest: Add RecordBuilder Apr 22, 2024
@pellared pellared marked this pull request as ready for review April 22, 2024 10:08
@pellared pellared requested a review from XSAM April 22, 2024 10:14
@pellared
Copy link
Member Author

Closing per #5258

@pellared pellared closed this Apr 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.

Cannot test all fields of a Record
3 participants