Implement custom protoc plugin to generate OTLP JSON class definitions#4910
Implement custom protoc plugin to generate OTLP JSON class definitions#4910herin049 wants to merge 5 commits intoopen-telemetry:mainfrom
Conversation
f66380d to
a9d10c7
Compare
|
I am very much looking forward to this landing: |
codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/analyzer.py
Outdated
Show resolved
Hide resolved
|
I think it would be valuable to add a test that validates the generated JSON by feeding it to |
Just to make sure I understand your suggestion properly, currently I have an integration test which runs the plugin to generate the ProtoJSON Python classes and tests the serialization/deserialization. Are you suggesting that we also generate the corresponding Protobuf definitions and then perform the JSON serialization using the ProtoJSON classes, load the JSON using the Protobuf definitions and then compare the attributes on the ProtoJSON and Protobuf classes? |
4d4119c to
4bce86a
Compare
|
@pmcollins Since we mostly care about serialization for the SDK, I added tests to use |
|
Thanks @herin049. My suggestion is to simulate a Collector receiving JSON. In other words, end-to-end tests that create SDK objects typically sent to an exporter for emission (traces, metrics, and logs), serialize those objects into JSON using the functionality in this PR, send that JSON to our simulated Collector ( |
|
@pmcollins I will be adding the |
|
Makes sense @herin049 -- can be in a subsequent PR. |
Description
This PR implements a custom protoc plugin to automatically generate OTLP JSON class definitions. Consensus was reached deciding that a custom protoc plugin would be the best route for adding support for OTLP JSON while minimizing the number of runtime dependencies (for additional context reference #4886). This PR is a refined version of the first part of a set of changes that are in #4902. Please view the draft PR for an overview of how these packages will be used.
Fixes #1003
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
tox run -e $(tox --listenvs | grep opentelemetry-protojson | tr '\n' ',')Does This PR Require a Contrib Repo Change?
Checklist: