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

Add None check for grpc.aio interceptor #3109

Merged

Conversation

ordinary-jamie
Copy link
Contributor

@ordinary-jamie ordinary-jamie commented May 29, 2024

Add a None check in gRPC AIO interceptor.

Address issue: #3108

grpc.aio.ServerInterceptor should expect the continuation to return None if the RPC isn't handled. Checking the return of continuation is not None before getting the handler_factory prevents an AttributeError

References

  1. gRPC Python Docs on return types for interceptors, https://grpc.github.io/grpc/python/grpc_asyncio.html#grpc.aio.ServerInterceptor
  2. Example implementation: https://github.com/d5h-foss/grpc-interceptor/blob/master/src/grpc_interceptor/server.py#L48-L57

General Notes

Thank you for contributing to sentry-python!

Please add tests to validate your changes, and lint your code using tox -e linters.

Running the test suite on your PR might require maintainer approval. Some tests (AWS Lambda) additionally require a maintainer to add a special label to run and will fail if the label is not present.

For maintainers

Sensitive test suites require maintainer review to ensure that tests do not compromise our secrets. This review must be repeated after any code revisions.

Before running sensitive test suites, please carefully check the PR. Then, apply the Trigger: tests using secrets label. The label will be removed after any code changes to enforce our policy requiring maintainers to review all code revisions before running sensitive tests.

Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty @ordinary-jamie !
need to make the linter happy, see comment

sentry_sdk/integrations/grpc/aio/server.py Outdated Show resolved Hide resolved
@sl0thentr0py sl0thentr0py added the Trigger: tests using secrets PR code is safe; run CI label May 29, 2024
@github-actions github-actions bot removed the Trigger: tests using secrets PR code is safe; run CI label May 29, 2024
@sl0thentr0py sl0thentr0py added the Trigger: tests using secrets PR code is safe; run CI label May 29, 2024
@sl0thentr0py sl0thentr0py force-pushed the grpc-interceptor-none-handling branch from 972a0c4 to 3ee457d Compare May 29, 2024 13:47
@github-actions github-actions bot removed the Trigger: tests using secrets PR code is safe; run CI label May 29, 2024
@sl0thentr0py sl0thentr0py added the Trigger: tests using secrets PR code is safe; run CI label May 29, 2024
@sl0thentr0py sl0thentr0py enabled auto-merge (squash) May 29, 2024 13:48
@sl0thentr0py sl0thentr0py merged commit 84775a0 into getsentry:master May 29, 2024
110 of 113 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Trigger: tests using secrets PR code is safe; run CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants