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

Convert events metadata type to google.protobuf.Struct #19130

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

tomhjp
Copy link
Contributor

@tomhjp tomhjp commented Feb 10, 2023

The bytes type gets seralised as base64 by protojson when marshalled into JSON, whereas google.protobuf.Struct is the equivalent of a JSON object, so gives us a bit of structure, but still plenty of flexibility that fits in with common models of metadata, as well as nice human-readable serialisation over JSON.

As JSON before:

{"event":{"id":"323c94b3-2638-1e2b-cfd8-2b135b369400","metadata":"eyJjdXJyZW50X3ZlcnNpb24iOiIyIiwib2xkZXN0X3ZlcnNpb24iOiIwIiwicGF0aCI6ImRhdGEvZm9vIn0="},"eventType":"kv-v2/data-write","pluginInfo":{"mountClass":"secret","mountAccessor":"kv_18df2fbe","mountPath":"secret/","plugin":"kv"},"timestamp":"2023-02-10T11:14:24.899815Z"}

As JSON after:

{"event":{"id":"cb003f60-17b8-b299-d71b-082adda7fdd3", "metadata":{"current_version":"1", "oldest_version":"0", "path":"data/foo"}}, "eventType":"kv-v2/data-write", "pluginInfo":{"mountClass":"secret", "mountAccessor":"kv_e26c7797", "mountPath":"secret/", "plugin":"kv"}, "timestamp":"2023-02-10T12:26:58.558572Z"}

@tomhjp tomhjp requested a review from swenson February 10, 2023 17:49
@tomhjp tomhjp added this to the 1.13.0-rc1 milestone Feb 10, 2023
Copy link
Contributor

@swenson swenson left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants