-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat(attribute): add int32 support #6299
feat(attribute): add int32 support #6299
Conversation
cpeliciari
commented
Feb 11, 2025
- Extend Value with Int32Value and Int32SliceValue.
- Extend KeyValue with Int32 and Int32Slice.
- Extend the Key type with Int32 and Int32Slice methods.
- Extend Value with Int32Value and Int32SliceValue. - Extend KeyValue with Int32 and Int32Slice. - Extend the Key type with Int32 and Int32Slice methods.
The committers listed above are authorized under a signed CLA. |
Int32 is not spec compliant. |
What I created is a way to convert int32 values to int64. If you look at the commit, you’ll see that I’m not implementing int32 within the attribute, but rather performing a conversion. I noticed that there is one for Int, but not for Int32. opentelemetry-go/attribute/key.go Lines 32 to 41 in c0a9fe9
|
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.
int32 within the attribute, but rather performing a conversion.
I think that adding this would be violating the Principle of Least Astonishment.
Moreover conversion (for slices) is coming with an overhead. I think it is in Go philosophy that things that needs to be converted or have additional cost are required to be done explicitly. "Write boring Go code".
If the specification would extend the to support int32
then we would need to make a behavioral change of Int32
variants that are introduced in this PR.
Closing per #6299 (review) @open-telemetry/go-maintainers, feel free to reopen or discuss at the SIG meeting if you disagree with my decision. @cpeliciari, I still want to thank you for your contribution. I deeply appreciate your efforts and time spend on this PR. I simply think that adding this can bring confusion to other users of the API. Notice that the changes you are proposing can also done as (local) helper functions. |