| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Hi @jdpedrie . I am trying to solve the spanner issue you submitted in gRPC repo by hooking a channel management support via call invoker, which is implement in the link above. I am testing it with zhouyihaiding/grpc-gcp-test composer package. |
Sorry, something went wrong.
|
I think I find the place: https://github.com/googleapis/gapic-generator/blob/master/src/main/resources/com/google/api/codegen/php/client_impl.snip#L367. But by doing so, all gapic client will be updated. |
Sorry, something went wrong.
|
Oh I think I use the wrong SpannerClient. It should be the Spanner/src/SpannerClient.php instead of Spanner/src/V1/Spanner.php |
Sorry, something went wrong.
|
My apologies for the delayed response @ZhouyihaiDing. I was out of town for the past few days. I'll take a look today! |
Sorry, something went wrong.
|
Thanks, @jdpedrie ! |
Sorry, something went wrong.
|
As a quick note in regards to src/V1/SpannerClient.php (the generated client) vs. src/SpannerClient.php (veneer client) - It actually strikes me as preferable to make the change in the generated client. If we solve this there, we could get the benefit of this configuration amongst all our components (some of which only have generated clients). Also - the veneer wraps the generated client, so we can satisfy users who use either client. |
Sorry, something went wrong.
|
Thanks! That makes sense. I am going to add more unit tests if there is no $api.grpc.config set. |
Sorry, something went wrong.
|
Sounds like a solid plan 👍 |
Sorry, something went wrong.
| : null | ||
| ); | ||
|
|
||
| if (isset($config['enable-gcp'])) { |
|
Thanks! I am going to use enable-gcp-optimizer. |
Sorry, something went wrong.
| */ | ||
| private $longRunningGrpcClients; | ||
|
|
||
| private function enableChonnectionManagement($conf_path) |
There was a problem hiding this comment.
Looks ok to me. @dwsupplee can you weigh in as well?
Sorry, something went wrong.
|
Sure thing, will review today |
Sorry, something went wrong.
|
It's not good to let the user sets the flag to enable the grpc-gcp library by themselves. We should handle it inside cloud-php by ourself. I removed the flag enableGcpOptimizer exposed to the client config. The support is enabled by default now and can be disabled by an environment flag. Later we can use the grpc.spanner.config file to enable/disable the support(like adding a line enable_gcp: true). Since the user doesn't the way we enable/disable the support, it won't affect the user. Update: |
Sorry, something went wrong.
|
@ZhouyihaiDing, I think I may have misunderstood our previous discussion. I thought we were going to tackle this in the spanner generated client first, then figure out a process for the others. |
Sorry, something went wrong.
|
Hi @dwsupplee . I think it is still the plan. We first enable the gcp library for the spanner client. It is enabled inside cloud-php so the user doesn't need to config it. I will also create a same PR to the repo GoogleCloudPlatform/google-cloud-php-spanner after this PR gets merged. cc: @wenbozhu |
Sorry, something went wrong.
|
Hi @dwsupplee @jdpedrie @chingor13 I think the gcp library is ready to be merged and used in the cloud-php which spanner client will use it first due to the issue #1052. I modified the PR and removed the flag from the client config. It should only be seens and enabled/disabled by the cloud-php. The environment variable is supposed to be used for the first gcp library release. Later we can remove it and use gcp library all the time. If there are failures caused by the new release, we only need to rollback the library version inside composer.json. If you have some suggestions about it, please let me know. Can you please take a look at this PR and merge it if there are no other concerns? |
Sorry, something went wrong.
There was a problem hiding this comment.
In your comment you mention not having to deal with GAX - is there a reason for this? It seems like working this into the GAPICs themselves seems like the ideal way to move forward. Would you be open to us helping to port this concept over into GAX/the generated clients?
Sorry, something went wrong.
| // TODO(ddyihai): move this function to GrpcTrait, if we are going | ||
| // to enable the grpc-gcp library for other apis. | ||
| $conf = new ApiConfig(); | ||
| $conf->mergeFromJsonString($string = file_get_contents($conf_path)); |
| */ | ||
| private $longRunningGrpcClients; | ||
|
|
||
| private function enableConnectionManagement($conf_path) |
| */ | ||
| public function __construct(array $config = []) | ||
| { | ||
| if (getenv("ENABLE_GCP_OPTIMIZER") === false) { |
| // to enable the grpc-gcp library for other apis. | ||
| $conf = new ApiConfig(); | ||
| $conf->mergeFromJsonString($string = file_get_contents($conf_path)); | ||
| $config = new Config($conf); |
|
Hi @dwsupplee , to answer you the concern on GAX: there's been a long discussion between us and the gcp client library team (specifically spanner team), and we came into a conclusion that it's better that this extension library is used directly by them, instead of the GAX layer, and it's also done this way in other languages like Python and C#. This extension is highly coupled with the grpc library. Currently we make this as an add-on to fix some GCP specific issues, in future some of the extension logic may even be moved down to the grpc core layer. Also, the gcp extension features are not meant to work on all cloud APIs, currently this channel management work only applies to storage APIs like spanner and bigtable. So we believe the better place to put this library would be the client library directly. |
Sorry, something went wrong.
|
@WeiranFang thanks for the explanation and context :). Moving the logic down to the gRPC core layer sounds great. I didn't mean to suggest that the bulk of that logic should live in GAX, but rather the orchestration of enabling the optimizer could. For example, we could consider adding the configuration file to the resources directory for the GAPIC. From there, when a user instantiates a GAPIC (or we do, as part of wrapping it for the handwritten layer), GAX would check to see if the configuration file exists and then enable optimization. That would give us fine-grained control over which services use the optimization (it could be controlled by whether or not the configuration file exists) and would make sure we help out our users who directly use the GAPICs just as easily as those using the handwritten veneer layer. With that said, if you see the configuration file being no longer needed as part of moving the logic into gRPC core - then I am definitely happy with moving forward with what we have now. |
Sorry, something went wrong.
|
Hi @dwsupplee , per discussion we had before, I have submitted PR in googleapis/gax-php#207 and googleapis/gapic-generator#2231 . Please take a look whenever you get chance. Thank you! |
Sorry, something went wrong.
|
Now that we've ported this over, I think all we need from this PR is to introduce the configuration file, update the GAPIC, and make sure we are updated to the latest version of GAX (when it is released). 👍 Nice work on this @WeiranFang and @ZhouyihaiDing. |
Sorry, something went wrong.
|
@WeiranFang / @ZhouyihaiDing since we moved the remaining work for this into another PR, I'll close this out. Please re-open if needed. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR works is used to express the idea for enabling the grpc-gcp library. It depends on PR: GCP library for channel management.
Hi @chingor13 @tmatsuo @bshaffer . I find that there is no extra layer between the user and the generated client like SpannerGapicClient. It seems I need to change the gcp.APIGenerator to regenerate SpannerGapicClient.php. I didn't find where it is generated, can you please give me some suggestions?
My idea is when the user sets ['enable_gcp' => true], Spanner client will read the $api.grpc.config and put the constructed $call_invoker into the $options. The way python does it is when the user calls import grpc_gcp, it will enable the gcp support.
In addition, I am not sure how to run spanner tests locally. I followed what travis did, but there were lot of errors.
Update:
I was wrong because I was looking at the generated SpannerClient.php instead of the real client. I think I can insert the code between the src/SpannerClient.php and the src/V1/SpannerClient.php to avoid involving gax repository.
Waiting for the gRPC 1.13.0 update.