-
Notifications
You must be signed in to change notification settings - Fork 276
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
Revisit enum value names #363
Comments
/cc @jmacd - as you added the |
Renaming |
@dyladan and as pointed in the description, the rename of the flag values is protobuf binary and JSON encoding backwards compatible since they are never on the wire, only used as helpers for producer/consumer to look into the |
ah sorry i didn't read closely enough. the generated code problem is also not affecting us right now, but we were planning to move to generated code for the OTLP exporters soon if possible, but it won't be publicly accessible. Just an internal detail. |
Arguably this is fine. Flags can be plural to indicate this is a bit mask. If we go with this logic then the only change needed is to add |
I think it is a good way to pack small fields reasonably. I don't think we want to move it to common since we may want to add other flags which are only applicable to |
Resolves open-telemetry#363 The rules are: - Place enums outside the messages. - Prefix the enum value names with enum name, using underscores with uppercase. The changes in this PR should be backwards compatible (or allowed because they are in experimental parts): - For Binary Protobuf: the encoding does not use enum names anywhere on the wire. There are no changes on the wire at all. - For JSON Protobuf: - DataPointFlags and LogRecordFlags are not visible on the wire since they are just helper enums to be used in the code. - Moving SpanKind and StatusCode out of the message should not result in any changes on the wire. - ConstantDecision is experimental and we are free to break it. I would like someone to independently confirm my analysis to make sure this PR does not break anything on the wire (neither for binary nor for JSON).
Resolves open-telemetry#363 The rules are: - Place enums outside the messages. - Prefix the enum value names with enum name, using underscores with uppercase. The changes in this PR should be backwards compatible (or allowed because they are in experimental parts): - For Binary Protobuf: the encoding does not use enum names anywhere on the wire. There are no changes on the wire at all. - For JSON Protobuf: - DataPointFlags and LogRecordFlags are not visible on the wire since they are just helper enums to be used in the code. - Moving SpanKind and StatusCode out of the message should not result in any changes on the wire. - ConstantDecision is experimental and we are free to break it. Note: all of these changes are breaking for the code that consumes the generated proto files. We consider this acceptable since this repository is not yet declared Stable. I would like someone to independently confirm my analysis to make sure this PR does not break anything on the wire (neither for binary nor for JSON).
Resolves open-telemetry#363 The rules are: - Place enums outside the messages. - Prefix the enum value names with enum name, using underscores with uppercase. The changes in this PR should be backwards compatible (or allowed because they are in experimental parts): - For Binary Protobuf: the encoding does not use enum names anywhere on the wire. There are no changes on the wire at all. - For JSON Protobuf: - DataPointFlags and LogRecordFlags are not visible on the wire since they are just helper enums to be used in the code. - Moving SpanKind and StatusCode out of the message should not result in any changes on the wire. - ConstantDecision is experimental and we are free to break it. Note: all of these changes are breaking for the code that consumes the generated proto files. We consider this acceptable since this repository is not yet declared Stable. I would like someone to independently confirm my analysis to make sure this PR does not break anything on the wire (neither for binary nor for JSON).
This is the only remaining issue that prevents declaration of OTLP/JSON stable. I tried 2 different PR but wasn't able to resolve this, so we need someone else to take this. |
Fixes open-telemetry#363 The reason is to keep the proto interface as minimal as possible, and the helper masks are just helpers, and not part of the protocol. They can be defined by the language SIGs in their usages, but don't need to be part of the proto stability. Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Fixes open-telemetry#363 The reason is to keep the proto interface as minimal as possible, and the helper masks are just helpers, and not part of the protocol. They can be defined by the language SIGs in their usages, but don't need to be part of the proto stability. Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This needs to be resolved for 1.0. I don't know how to solve it. Help is needed. |
@tigrannajaryan as simple as removing the helpers for 1.0 :)) that solves 2 issues in the same time :) |
For the record, I think we should keep every existing enum as-is and declare 1.0. |
Discussed in TC meeting and decided that #461 should be sufficient and we can close this issue. |
Background
Currently we do not have a consistent way of naming values in the enums:
Out of the 6 public enums 4 follow the same convention to prefix the value with the name of the enum to avoid conflicts (proto require that enum values are unique within a package, c++ requirement).
Luckily the 2 that do not follow are actually helper enums (not used in the real proto, not that it matters except for JSON format).
Proposal
We should follow the same convention, and probably document the convention for all enum values.
For
LogRecordFlags
(orLogRecordFlags
->LogRecordFlag
):LOG_RECORD_FLAG_UNSPECIFIED
->LOG_RECORD_FLAG[S]_UNSPECIFIED
LOG_RECORD_FLAG_TRACE_FLAGS_MASK
->LOG_RECORD_FLAG[S]_TRACE_FLAGS_MASK
For
DataPointFlags
:FLAG_NONE
->DATA_POINT_FLAGS_NONE
FLAG_NO_RECORDED_VALUE
->DATA_POINT_FLAGS_NO_RECORDED_VALUE
Open Question
LogRecordFlags
needed? If needed this most likely need to be in a common package since traceid/spanid are used in multiple places and probably flags will be added there as well.Extra Problem
Especially on the tracing side, the enums are embedded into messages like
Span {SpanKind}
which makes generated code look a bit strange (e.g.Span_SpanKindClient
).Moving them to the main package instead of embedding them in the message is JSON encoding and protobuf encoding backwards compatible. We probably should consider that as well as part of the cleanup.
The text was updated successfully, but these errors were encountered: