Stateless grpc connection#19
Open
shiroyasha wants to merge 6 commits into
Open
Conversation
radwo
reviewed
Apr 7, 2022
| Util.Grpc.Client.new(:billing_service, "localhost:50051", BillingApi.Stub) | ||
| ]) | ||
|
|
||
| 3. User Grpc.do to communicate with your upstream services: |
Member
There was a problem hiding this comment.
Suggested change
| 3. User Grpc.do to communicate with your upstream services: | |
| 3. User Grpc.call to communicate with your upstream services: |
| 2. Sends the RPC request | ||
| 3. Waits for the result, or times out | ||
| """ | ||
| @spec rpc(client_name(), GRPC.Channel.t(), function()) :: |
Member
There was a problem hiding this comment.
Suggested change
| @spec rpc(client_name(), GRPC.Channel.t(), function()) :: | |
| @spec call(client_name(), GRPC.Channel.t(), function()) :: |
mattrym
reviewed
Apr 7, 2022
| end | ||
|
|
||
| def find_client(name) do | ||
| Agent.get(__MODULE__, fn state -> Map.fetch!(state, name) end) |
There was a problem hiding this comment.
Minor thing: Agent.get/2 callback is executed internally by Agent process, and Map.fetch! raises unhandled exception in case of failure. Calling find_client/1 with unknown name will crash the State, not sure if that's by design?
Author
There was a problem hiding this comment.
Good point. I'll have to fix it ✍️
radwo
reviewed
Apr 10, 2022
| {:ok, result} | ||
|
|
||
| {:error, err} -> | ||
| inc(rpc, "response.error.count") |
Member
There was a problem hiding this comment.
Sometimes we send:ok response, and an error status is present in the status field. Can we check if this field is there and log accordingly?
e8cd47d to
a45ab9e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disclaimer: This is still a draft, tests, and code quality are still pretty poor.
There are several errors that still need to be caught.
I'm attaching you to check out the public API of the clients.
edit: I can't attach @mattrym for some reason. I'm pinging you directly.