Skip to content
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

Replace ULIDs by 16 byte ids and recommend UUID v7 #186

Merged

Conversation

tigrannajaryan
Copy link
Member

The early version of the spec was written before UUID v7 existed and ULID was chosen as a ID type that is suited to be used as a primary key in databases. Since than UUID v7 was standardized and aims to serve the exact same niche.

Proposal

Replace instance_id definition to be an arbitrary sequence of 16 bytes. Both ULID and any version of UUID may be used as the value. We also recommend to use UUID v7 for the value.

This is a breaking change in the spec. We recommend opamp-go implementation to implement the change in backward compatible way, supporting both old and new instance_uid formats for a period of time.

Since bytes and string are compatible in the Protobuf wire encoding it is possible to use the new Protobuf declarations to receive messages encoded using the old Protobuf declarations - string's UTF8 bytes will simply populate the bytes of the new field. Receivers can simply probe for the length of the received bytes field and if it is 26 treat it as ULID in canonical format, if it is 16 bytes treat it as opaque id in new format, otherwise consider it invalid.

I will also post a PR in opamp-go that implements the above behavior.

@tigrannajaryan tigrannajaryan requested a review from a team April 17, 2024 14:48
tigrannajaryan added a commit to tigrannajaryan/opamp-go that referenced this pull request Apr 17, 2024
Implements spec change open-telemetry/opamp-spec#186

The example server still accepts old-style ULID agent instances to
demonstrate how this change can be handled in a backward compatible way.
tigrannajaryan added a commit to tigrannajaryan/opamp-go that referenced this pull request Apr 17, 2024
Implements spec change open-telemetry/opamp-spec#186

The example server still accepts old-style ULID agent instances to
demonstrate how this change can be handled in a backward compatible way.
@tigrannajaryan
Copy link
Member Author

Corresponding implementation in opamp-go: open-telemetry/opamp-go#272

@tigrannajaryan
Copy link
Member Author

@andykellr I am going to make a 0.9.0 release of the spec first, so that this change if merged goes into the next 0.10.0 release.

proto/opamp.proto Outdated Show resolved Hide resolved
proto/opamp.proto Outdated Show resolved Hide resolved
specification.md Outdated Show resolved Hide resolved
specification.md Outdated Show resolved Hide resolved
@tigrannajaryan
Copy link
Member Author

@andykellr I want to keep opamp-go examples interoperable with Bindplane OP. If we go ahead with this and then also merge open-telemetry/opamp-go#272 do you think you will be able to quickly make Bindplane compatible with the new spec so that opamp-go client example can work with it?

The early version of the spec was written before UUID v7 existed and
ULID was chosen as a ID type that is suited to be used as a primary
key in databases. Since than UUID v7 was standardized and aims to
serve the exact same niche.

## Proposal

Replace instance_id definition to be an arbitrary sequence of 16 bytes.
Both ULID and any version of UUID may be used as the value. We also
recommend to use UUID v7 for the value.

This is a breaking change in the spec. We recommend opamp-go implementation
to implement the change in backward compatible way, supporting both old and
new instance_uid formats for a period of time.

Since `bytes` and `string` are compatible in the Protobuf wire encoding
it is possible to use the new Protobuf declarations to receive messages
encoded using the old Protobuf declarations - string's UTF8 bytes
will simply populate the bytes of the new field. Receivers can simply
probe for the length of the received bytes field and if it is 26 treat
it as ULID in canonical format, if it is 16 bytes treat it as opaque
id in new format, otherwise consider it invalid.

I will also post a PR in opamp-go that implements the above behavior.
Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one quick question

proto/opamp.proto Show resolved Hide resolved
@andykellr
Copy link
Contributor

@andykellr I want to keep opamp-go examples interoperable with Bindplane OP. If we go ahead with this and then also merge open-telemetry/opamp-go#272 do you think you will be able to quickly make Bindplane compatible with the new spec so that opamp-go client example can work with it?

Bindplane only requires a string.

@tigrannajaryan
Copy link
Member Author

@andykellr I want to keep opamp-go examples interoperable with Bindplane OP. If we go ahead with this and then also merge open-telemetry/opamp-go#272 do you think you will be able to quickly make Bindplane compatible with the new spec so that opamp-go client example can work with it?

Bindplane only requires a string.

@andykellr Will it work correctly if the string contains arbitrary bytes? Protobuf spec says strings must be UTF8 compliant although not all receiver implementations validate it.

@andykellr
Copy link
Contributor

@andykellr I want to keep opamp-go examples interoperable with Bindplane OP. If we go ahead with this and then also merge open-telemetry/opamp-go#272 do you think you will be able to quickly make Bindplane compatible with the new spec so that opamp-go client example can work with it?

Bindplane only requires a string.

@andykellr Will it work correctly if the string contains arbitrary bytes? Protobuf spec says strings must be UTF8 compliant although not all receiver implementations validate it.

Interesting. It sounds like this will present a problem until we expect the id to be an arbitrary array of 16 bytes.

@tigrannajaryan
Copy link
Member Author

Interesting. It sounds like this will present a problem until we expect the id to be an arbitrary array of 16 bytes.

@andykellr I am not sure Go protobuf deserializer validates this. It may be worth checking. If there is no validation it will be seen as just another string (possible with invalid UTF8 sequences).

@BinaryFissionGames
Copy link
Contributor

Interesting. It sounds like this will present a problem until we expect the id to be an arbitrary array of 16 bytes.

@andykellr I am not sure Go protobuf deserializer validates this. It may be worth checking. If there is no validation it will be seen as just another string (possible with invalid UTF8 sequences).

I did check this against BindPlane, looks like the deserializer does indeed validate that the string is UTF-8. It'll definitely be a priority for us to update after this and open-telemetry/opamp-go#272 is merged; I think our goal would be to have BindPlane updated to support a week or 2 after it's released.

@tigrannajaryan
Copy link
Member Author

I did check this against BindPlane, looks like the deserializer does indeed validate that the string is UTF-8. It'll definitely be a priority for us to update after this and open-telemetry/opamp-go#272 is merged; I think our goal would be to have BindPlane updated to support a week or 2 after it's released.

@BinaryFissionGames @andykellr OK, I think we are ready here in the spec and in opamp-go. If the timing works for you we can go ahead and merge this PR.

@BinaryFissionGames
Copy link
Contributor

@tigrannajaryan Yep, we're good with merging this 👍

@tigrannajaryan tigrannajaryan merged commit f1f80ae into open-telemetry:main May 7, 2024
5 checks passed
@tigrannajaryan tigrannajaryan deleted the feature/tigran/ulid-uuid branch May 7, 2024 17:29
tigrannajaryan added a commit to tigrannajaryan/opamp-go that referenced this pull request May 14, 2024
Updates OpAMP spec to 0.9.0 and implements spec change open-telemetry/opamp-spec#186

The example server still accepts old-style ULID agent instances to
demonstrate how this change can be handled in a backward compatible way.
Replace ULIDs by 16 byte ids and recommend UUID v7 (open-telemetry#186)
tigrannajaryan added a commit to open-telemetry/opamp-go that referenced this pull request May 27, 2024
Updates OpAMP spec to 0.9.0 and implements spec change open-telemetry/opamp-spec#186

The example server still accepts old-style ULID agent instances to
demonstrate how this change can be handled in a backward compatible way.
Replace ULIDs by 16 byte ids and recommend UUID v7 (#186)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants