Skip to content
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

opentelemetry-exporter-otlp does not work with protobuf 4.x #2794

Closed
thatsdone opened this issue Jul 1, 2022 · 1 comment
Closed

opentelemetry-exporter-otlp does not work with protobuf 4.x #2794

thatsdone opened this issue Jul 1, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@thatsdone
Copy link

Hi, I think now we need to explicitly specify version of protobuf pip package that is used from opentelemetry-exporter-otlp.

Reasonable resolution would be noting this topic somewhere in the documentation, IMHO.

Describe your environment

  • Ubuntu 20.04 or 22.04 (docker image)
  • Python 3.8.10 (Ubuntu 20.04) or Python 3.10.4 (Ubuntu 22.04)
  • opentelemetry 1.11.1 (also tried 1.9.1)
  • protobuf 4.21.2 (current latest release at pypi.org)

Steps to reproduce

You would see a stack trace like below so far as the installed protobuf version is 4.x.
At least, protobuf 3.20.1 (current latest 3.x series release) works.

# python3 test1.py
Traceback (most recent call last):
  File "test1.py", line 40, in <module>
    from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
  File "/usr/local/lib/python3.8/dist-packages/opentelemetry/exporter/otlp/proto/grpc/trace_exporter/__init__.py", line 22, in <module>
    from opentelemetry.exporter.otlp.proto.grpc.exporter import (
  File "/usr/local/lib/python3.8/dist-packages/opentelemetry/exporter/otlp/proto/grpc/exporter.py", line 39, in <module>
    from opentelemetry.proto.common.v1.common_pb2 import (
  File "/usr/local/lib/python3.8/dist-packages/opentelemetry/proto/common/v1/common_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "/usr/local/lib/python3.8/dist-packages/google/protobuf/descriptor.py", line 560, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

What is the expected behavior?

No stack trace.

What is the actual behavior?

OTEL client program works w/o the stacktrace.

@thatsdone thatsdone added the bug Something isn't working label Jul 1, 2022
@srikanthccv
Copy link
Member

Duplicate of #2717

@srikanthccv srikanthccv marked this as a duplicate of #2717 Jul 1, 2022
@srikanthccv srikanthccv closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants