-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[pdata] Remove Val suffix from pcommon.Value getter/setter methods #6099
Conversation
31c1eea
to
550201b
Compare
Codecov ReportBase: 91.91% // Head: 91.77% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #6099 +/- ##
==========================================
- Coverage 91.91% 91.77% -0.14%
==========================================
Files 217 217
Lines 13317 13345 +28
==========================================
+ Hits 12240 12248 +8
- Misses 848 868 +20
Partials 229 229
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I like the new API... Want to hear more opinions. @open-telemetry/collector-approvers ? |
550201b
to
25d0b5e
Compare
@bogdandrutu If we merge this, we will still have |
25d0b5e
to
505bb48
Compare
Maybe that should be Value? |
@dmitryax what about the metrics data type then? We definitely are not consistent here |
I am not sure this is an improvement. Get prefix is explicitly not recommended by Effective Go for getters. Granted, Val suffix is also not pretty. Minor argument in favour of Val suffix: it is faster to use with autocomplete, less characters to type until you get the right hint. However, I can live with either approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot. Get and Set feel like natural prefixes for this situation, even if it goes against Go naming standards
Yes,
We are not, yes. We don't have any prefix or suffix for the metric type getters, it's just |
This is pretty annoying, and if we can't use But I also have a bias towards languages with Getters and Setters. An argument could be made that for Go |
This makes me really wish we could just do |
@dmitryax please summarize the conversation in the issue:
So let's enumerate the rules that we want to apply (or exceptions if any) and apply them and see what we get. By apply just some code snippets it is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I preferred BoolVal
to GetBool
until I realized that Get
would be a better pair to Set
in SetBool
.
505bb48
to
f4f0771
Compare
Please do not merge until a decision is made on #6081 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid merging until decision in the issue is made
f4f0771
to
c1a58b3
Compare
41c213d
to
9391db7
Compare
9391db7
to
646d1d4
Compare
// StringVal returns the string value associated with this Value. | ||
// If the Type() is not ValueTypeString then returns empty string. | ||
// Str returns the string value associated with this Value. | ||
// The shorter name is used instead of String to avoid implementing fmt.Stringer interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider to have this comment on the "SetStr" as well.
Resolves #6081