opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

Compatible workaround to support both protobuf <=3.20 and >=4.21

Open gen-xu opened this issue 3 years ago • 0 comments

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/ or opentelemetry-sdk/

  • The method interfaces of test/util have 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.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.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

gen-xu avatar Sep 29 '22 19:09 gen-xu