-
Notifications
You must be signed in to change notification settings - Fork 454
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
Refactor AnyValue enum? #1917
Comments
Thanks @utpilla. Very good points. Regarding 1 and 2, it's worth testing if the tracing library allows emitting attributes with None (encapsulated within Options) value or values with iterators to HashMap or Vector. Looking into the tracing doc, it seems possible (basically it supports anything which implements Regarding 3, the struct approach seems good, though it does introduce another level of indirection. We can also evaluate other approaches, such as adding a catch-all |
On 7/9 SIG, we also discussed the need to make AnyValue and Value Enum variants consistent. The former provides conversion for lower size integers, but the latter does not. We should be consistent here. |
@cijothomas Why is there both I would be willing to send a PR to refactor value handling to use a single consistent type. I also agree with the points in the first message: |
This is discussed here - #1253 (comment) |
Rust doesn't have a built-in |
Thank you very much. I checked in the spec before posting but missed this part. It's a bit confusing to have similar but different value types. I was also confused because the proto definition does not make any distinction there. Here are some other spec discussions that I found about it:
Given the spec links, I see that It would still be good to have some better way to avoid duplication between these types, but it may be more complex than expected. |
There are a few concerns with the current implementation of
AnyValue
enum
:AnyValue
.AnyValue
variants such asHashmap<Key, AnyValue>
,Vec<Anyvalue>
, andVec<u8>
. We could get hold of the concrete type and do more targeted logging for these types.struct
instead ofenum
as the public interface for representingAnyValue
? Currently,AnyValue
enum is markedpublic
which means adding any new variant to it in the future would be a breaking change. We could probably use astruct
that wraps overAnyValue
enum and mark the enum private/internal. That would allow us to easily make changes to theenum
, thereby providing us the flexibility to make changes to the implementation easily.The text was updated successfully, but these errors were encountered: