-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add otel proto codegen forward serialization #42
Add otel proto codegen forward serialization #42
Conversation
# If generating the code produces any changes from what is currently checked in, the workflow will fail and prompt the user to regenerate the code. | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Check Codegen |
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.
👍
self._size = self.calculate_size() | ||
return self._size | ||
|
||
def __bytes__(self) -> bytes: |
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 seems exactly the same as SerializeToString
. I am curious what this is for?
Thanks for the work! Looks great Things verified:
Nit:
|
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.
These changes look good to me. I like the demonstration of interface equivalence in test_proto_serialization.py
.
One nit is to remove the from __future__ import annotations
lines, because they should not be required in this library. It only supports Python 3.8 and above.
Thanks for all the great work!
Description of PR
./scripts/proto_codegen.sh
, and the logic of the protoc plugin is in./scripts/plugin.py
. The plugin parses the protoc CodeGeneratorRequest which contains descriptors for the custom message definitions. It extracts relevant information for serialization and then uses the Jinja2 template./scripts/templates/template.py.jinja2
to generate the codesrc/snowflake/telemetry/_internal/opentelemetry/proto/**
black
,isort
,grpcio-tools
, andJinja2
, but does not add any runtime dependenciesprotobuf
package at 2MBsrc/snowflake/telemetry/_internal/serialize/**
Follow up PRs:
Testing
check-codegen
to ensure that the generated code is the latest generated code fromhypothesis
module. This module randomly generates inputs, and the test ensure the serialized bytestrings of this custom serialization module and protobuf are the exact same