opentelemetry-python
opentelemetry-python copied to clipboard
Compatible workaround to support both protobuf <=3.20 and >=4.21
Description
This is a work around for https://github.com/open-telemetry/opentelemetry-python/issues/2880
By checking the api implementation before define anything in the generated code, it is able to have both versions of generated protobuf and so it allows the opentelemetry-proto to work with both protobuf<=3.20 and protobuf>=4.21
Type of change
- [x] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
Tested with both protobuf~=3.19.4 and protobuf==4.21.6 by importing any generated modules and it should not throw any error
Does This PR Require a Contrib Repo Change?
Answer the following question based on these examples of changes that would require a Contrib Repo Change:
-
The OTel specification has changed which prompted this PR to update the method interfaces of
opentelemetry-api/oropentelemetry-sdk/ -
The method interfaces of
test/utilhave changed -
Scripts in
scripts/that were copied over to the Contrib repo have changed -
Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in
pyproject.tomlisort.cfg.flake8
-
When a new
.github/CODEOWNERis added -
Major changes to project information, such as in:
README.mdCONTRIBUTING.md
-
[x] Yes. - Link to PR: https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1363
-
[ ] No.
Checklist:
- [x] Followed the style guidelines of this project
- [x] Changelogs have been updated
- [ ] Unit tests have been added
- [ ] Documentation has been updated