-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add support for Protobuf type in API #106
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
base: main
Are you sure you want to change the base?
Conversation
fpacifici
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the design. As long as we have an explicit Parser step, it makes sense to have a Serializer. We can revisit whether to expose those steps later.
Please consider not depending on sentry-protos. It seems you only need them for examples. You should be able to create some example protobuf messages without.
| types-jsonschema, | ||
| "sentry-kafka-schemas>=1.2.0", | ||
| "types-protobuf", | ||
| "sentry-protos>=0.1.74" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is FSL, we cannot import it in an Apache 2.0 library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand it right that this is only used for tests? in that case why not write your own protobuf schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that, I just relied on existing ones out of ease of use and didn't know about the license issue
| elif schema_type is MessageSchema.JSON: | ||
| return json.dumps(payload).encode("utf-8") | ||
| else: | ||
| raise Exception(f"Unknown codec / message schema type {schema_type}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can catch this with the type checker with assert_never
As I see it there are 3 options for the API design re: message serializer step:
Don't have a separate
Serializer()step at all, have it embedded in the sink. The sink will determine from the topic what format to serialize the message into (assuming that the sink is a stream sink).Support a separate
Serializer(), but figure out the schema type from the topic name from the streaming pipeline as defined by the user. So the user does not need to tell us explicitly whether their data needs to be serialized into JSON or protobuf. Would have to figure out how we can implement this.Support a separate
Serializer()and have the user tell us explicitly the message schema type.This PR goes with Option 3 right now because:
TODO:
Mapbased on the contents of the Protobuf message structure)