-
Notifications
You must be signed in to change notification settings - Fork 132
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 an outbound health check #641
Conversation
Signed-off-by: Mukundan Sundararajan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to split out health check apis from the service invocation api, so that even when service invocation protocol is chosen as grpc, http is still used as the health check protocol.
@@ -173,3 +175,27 @@ async def invoke_method_async( | |||
else: | |||
raise NotImplementedError( | |||
'Please use `dapr.aio.clients.DaprClient` for async invocation') | |||
|
|||
def wait(self, timeout_s: float): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is float because DaprGrpcClient already has a method wait as float, I can remove that method if that would be better....
""" | ||
self.helath_client.wait(int(timeout_s)) | ||
|
||
async def wait_async(self, timeout_s: float): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is float because DaprGrpcClient already has a method wait as float, I can remove that method if that would be better....
"""Dapr Health Client""" | ||
|
||
def __init__(self, timeout: Optional[int] = 60): | ||
self._client = DaprHttpClient(DefaultJSONSerializer(), timeout, None, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a need to pass in address
from DaprClient initialization?
Both http and grpc might not have the same endpoint address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's unrelated to this PR IMO. We can open an issue for discussion in the future. I don't think we need to tackle that until someone has a concrete need for it. The HTTP Client is only used by Actors and by Service Invocation (and now the health client), though using the SDK for service invocation is no longer the recommended way. Perhaps you can take a look how the DotNet SDK handles this and compare.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #641 +/- ##
==========================================
+ Coverage 86.16% 86.23% +0.07%
==========================================
Files 75 76 +1
Lines 3737 3779 +42
==========================================
+ Hits 3220 3259 +39
- Misses 517 520 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating another instance of DaprHTTPClient and also the Serializer - why not a simple static utility method that uses urllib
? I would much prefer that.
That method could then be imported within the wait methods and used there.
Allocating an entire Dapr HTTP Client with Serializer just feels inefficient from a memory perspective.
Your change broke the configuration API example by the way
|
@@ -72,6 +73,7 @@ def __init__( | |||
""" | |||
super().__init__(address, interceptors, max_grpc_message_length) | |||
self.invocation_client = None | |||
self.helath_client = DaprHealthClient(timeout=http_timeout_seconds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.helath_client = DaprHealthClient(timeout=http_timeout_seconds) | |
self.health_client = DaprHealthClient(timeout=http_timeout_seconds) |
will change the PR to use |
Update on this? |
Description
closes #611
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #611
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: