-
Notifications
You must be signed in to change notification settings - Fork 3
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
Test refactor and fix client metrics #8
Conversation
* Add typing * Refactor proto gen to generate typing and all test files * Standardize test stub creation using random ports Signed-off-by: Aidan Jensen <[email protected]>
Move observation of client duration to after the code coroutine. The continuation coroutine doesn't actually wait for the call to complete Signed-off-by: Aidan Jensen <[email protected]>
@avik-taranis I found that the continuation did not actually wait for the call to finish, which is different than the sync version. So i moved it to after the code await, and its working now. I also had issues running the tests on the default ports, so I moved to a pattern of letting the server pick an unused port. |
Signed-off-by: Aidan Jensen <[email protected]>
I had to make a bunch of other changes to make the rest of the client interceptors work, including changing how they are instantiated because of this issue: grpc/grpc#31442 |
@artificial-aidan thanks for the PR!
|
Signed-off-by: Aidan Jensen <[email protected]>
Signed-off-by: Aidan Jensen <[email protected]>
|
@razsinay @shay-taranis can you take a look as well? |
registry=REGISTRY, | ||
): | ||
metrics = init_metrics(REGISTRY) | ||
_PromAsyncUnaryUnaryClientInterceptor.__init__( |
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.
Why not do _PromAsyncUnaryUnaryClientInterceptor()
etc in this case?
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.
Because this is instantiating each of the parent classes. It would be like calling super().__init__(...)
if there was only one parent class. And super works differently in multiple inheritance.
grpc_service=grpc_service_name, | ||
grpc_method=grpc_method_name).inc() | ||
yield item | ||
if timer: |
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.
Why is the timer necessary?
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.
The timer is to record the total time the call took for the server streaming to finish. I'm trying for parity with go interceptors: https://github.com/grpc-ecosystem/go-grpc-middleware/blob/main/interceptors/client.go
As I read this, the timer finishes after the EOF is sent, which is the same as when the iterator would stop iterating in python.
Signed-off-by: Aidan Jensen <[email protected]>
No description provided.