-
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
Different enum value for codes.Code than proto (see OK, Error) #2098
Comments
The conversion function we use is designed to avoid this problem. opentelemetry-go/exporters/otlp/otlptrace/internal/tracetransform/span.go Lines 131 to 144 in 0a56233
Having a translation that directly converts the underlying integer value to the the other type will indeed be brittle and would couple the two projects unnecessarily. The design of that conversion function was intended to never introduce this type of error. I'm not sure we should try to synchronize the enum ordering. It will add coupling between the two projects which is additional unneeded work, and it will inevitably result in bugs. Instead I think we should continue to convert by directly using the named variable types that actually have semantic meaning. |
But as you can see in #2099 the conversion is wrong because of that exact reason you mentioned :) |
I think that we should have an expectation that you need to go through the exporters API to convert between these different representations. The solutions I see right now are:
All that said, I wouldn't want to change the API unless there was some really compelling reason to. |
@MadVikingGod my main reason (with a clear proof) is that keeping them independent of the OTLP adds bugs (see the issue). So having the numbers aligned with the proto is a win (I think all the other languages do that). |
Community consensus from last SIG meeting was to only couple these types with the explicit conversion functions that we offer and to not have the underlying types synchronized. |
The otel-go defines:
https://github.com/open-telemetry/opentelemetry-go/blob/main/codes/codes.go#L23
The proto defines:
https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L312
I think the conversion to from codes.Code to proto will be extremely fragile.
The text was updated successfully, but these errors were encountered: