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

RFC: RPCEndpoint standardization #6363

Merged
merged 24 commits into from
Oct 3, 2024
Merged

RFC: RPCEndpoint standardization #6363

merged 24 commits into from
Oct 3, 2024

Conversation

volokluev
Copy link
Member

@volokluev volokluev commented Sep 30, 2024

Context

This project will need observability, monitoring and other production readiness facets. This PR creates a wrapper around our RPC functionality to allow:

  • default behavior for before and after each request execution (to allow for timing, reporting, rate limiting, etc)
  • automatic registering of endpoints by name without having to modify global dictionaries
  • listing all available endpoints (to allow for debugging tools such as in snuba admin)

Desired feedback

  • is the intent clear?
  • Do the interfaces look ergonomic?
  • Are the names appropriate?

tests/conftest.py Outdated Show resolved Hide resolved
from snuba.web.rpc import RPCEndpoint


class MyRPC(RPCEndpoint[Timestamp, Timestamp]):
Copy link
Member

Choose a reason for hiding this comment

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

add a comment or something? unclear what this is for

Copy link
Member

Choose a reason for hiding this comment

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

this is to test that the registration works?

@@ -5,17 +5,17 @@
import pytest
from google.protobuf.timestamp_pb2 import Timestamp
from sentry_protos.snuba.v1alpha.endpoint_tags_list_pb2 import (
TraceItemAttributesRequest,
TraceItemAttributesRequest as TraceItemAttributesRequestProto,
Copy link
Member

Choose a reason for hiding this comment

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

is annoying to have to do default imports like this, can we just make sentry-protos name things blahproto by default?

Copy link
Member

@evanh evanh left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -273,14 +273,11 @@ def unqualified_query_view(*, timer: Timer) -> Union[Response, str, WerkzeugResp


@application.route("/rpc/<name>/<version>", methods=["POST"])
@util.time_request("rpc")
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

not necessary, the RPC builds in a timer by default

@volokluev volokluev marked this pull request as ready for review October 3, 2024 14:38
@volokluev volokluev requested a review from a team as a code owner October 3, 2024 14:38
@volokluev volokluev requested a review from a team as a code owner October 3, 2024 14:38
@volokluev volokluev merged commit fa0a92f into master Oct 3, 2024
30 checks passed
@volokluev volokluev deleted the volo/eap/rpc_infra branch October 3, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants