Skip to content

sentry-sdk[grpcio] requires protobuf #3080

Closed

Description

@DazWilkin

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.2.0

Steps to Reproduce

See: https://stackoverflow.com/questions/78488561

Followed Sentry documentation gRPC

python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade 'sentry-sdk[grpcio]'

python3 -m pip freeze
certifi==2024.2.2
grpcio==1.63.0
sentry-sdk==2.2.0
urllib3==2.2.1

main.py:

import grpc

import sentry_sdk
from sentry_sdk.integrations.grpc import GRPCIntegration

sentry_sdk.init(
    dsn="https://...",
    enable_tracing=True,
    integrations=[
        GRPCIntegration(),
    ],
)

with grpc.insecure_channel("example.com:12345") as channel:
    print(channel)

Expected Result

Happy path.

Actual Result

python3 main.py
Traceback (most recent call last):
  File "[redacted]/venv/lib/python3.10/site-packages/sentry_sdk/integrations/grpc/client.py", line 15, in <module>
    from google.protobuf.message import Message
ModuleNotFoundError: No module named 'google'

integrations/grpc/client.py:

try:
    import grpc
    from grpc import ClientCallDetails, Call
    from grpc._interceptor import _UnaryOutcome
    from grpc.aio._interceptor import UnaryStreamCall
    from google.protobuf.message import Message      <-------------- curious
except ImportError:
    raise DidNotEnable("grpcio is not installed")

Solution

python3 -m pip install protobuf
python3 -m pip freeze
certifi==2024.2.2
grpcio==1.63.0
protobuf==5.26.1
sentry-sdk==2.2.0
urllib3==2.2.1

Then works.

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 16, 2024
  2. changed the title [-]`sentry-sdk[grpcio]` requires on [`protobuf`](https://pypi.org/project/protobuf/)[/-] [+]`sentry-sdk[grpcio]` requires `protobuf`[/+] on May 16, 2024
  3. self-assigned this
    on May 17, 2024
  4. antonpirker commented on May 17, 2024

    @antonpirker
    Contributor

    Hey @DazWilkin ! Thanks for bringing this up! I submitted a PR that fixes the problem by adding protobuf as an extra!

  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 17, 2024
  6. antonpirker commented on May 17, 2024

    @antonpirker
    Contributor

    Tested with my grpc test project locally and works now!

  7. novalic commented on May 17, 2024

    @novalic

    Tested with my grpc test project locally and works now!

    confirmed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions