Skip to content

Commit

Permalink
feat: introduce hot tablet/ping and warm RPCs (#5119)
Browse files Browse the repository at this point in the history
* feat: add WarmAndPing request for channel priming

PiperOrigin-RevId: 428795660

Source-Link: googleapis/googleapis@6cce671

Source-Link: googleapis/googleapis-gen@2282bc1
Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6IjIyODJiYzFiMDgxMzY0ZWE3ODMzMDBiZTkxYThjMTRjYjRhNzE4YzQifQ==

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Add ListHotTablets API method and protobufs

PiperOrigin-RevId: 436758628

Source-Link: googleapis/googleapis@92ab86a

Source-Link: googleapis/googleapis-gen@931ef11
Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6IjkzMWVmMTE0ZDVmODQ1YWJmMTE3YmY4ZTBhMjk4MzZjYTMwMGI2OTQifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* docs: Update `cpu_utilization_percent` limit
docs: Remove the limitation of all clusters in a CMEK instance must use the same key

PiperOrigin-RevId: 438385300

Source-Link: googleapis/googleapis@c59f02e

Source-Link: googleapis/googleapis-gen@04d03d1
Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6IjA0ZDAzZDE3YWFmYTdiNDQyMmY3M2M5MzYwMGYwNDA1NDI4MTdmY2QifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Mar 31, 2022
1 parent 4390ec8 commit a1986cb
Show file tree
Hide file tree
Showing 22 changed files with 1,279 additions and 14 deletions.
19 changes: 16 additions & 3 deletions Bigtable/metadata/Admin/V2/BigtableInstanceAdmin.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Bigtable/metadata/Admin/V2/Instance.php
Binary file not shown.
Binary file modified Bigtable/metadata/V2/Bigtable.php
Binary file not shown.
12 changes: 8 additions & 4 deletions Bigtable/src/Admin/V2/AutoscalingTargets.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Bigtable/src/Admin/V2/BigtableInstanceAdminGrpcClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,4 +366,20 @@ public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsReques
$metadata, $options);
}

/**
* Lists hot tablets in a cluster, within the time range provided. Hot
* tablets are ordered based on CPU usage.
* @param \Google\Cloud\Bigtable\Admin\V2\ListHotTabletsRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\UnaryCall
*/
public function ListHotTablets(\Google\Cloud\Bigtable\Admin\V2\ListHotTabletsRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.bigtable.admin.v2.BigtableInstanceAdmin/ListHotTablets',
$argument,
['\Google\Cloud\Bigtable\Admin\V2\ListHotTabletsResponse', 'decode'],
$metadata, $options);
}

}
4 changes: 0 additions & 4 deletions Bigtable/src/Admin/V2/Cluster/EncryptionConfig.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 93 additions & 2 deletions Bigtable/src/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@
use Google\Cloud\Bigtable\Admin\V2\GetAppProfileRequest;
use Google\Cloud\Bigtable\Admin\V2\GetClusterRequest;
use Google\Cloud\Bigtable\Admin\V2\GetInstanceRequest;

use Google\Cloud\Bigtable\Admin\V2\Instance;

use Google\Cloud\Bigtable\Admin\V2\Instance\Type;
use Google\Cloud\Bigtable\Admin\V2\ListAppProfilesRequest;
use Google\Cloud\Bigtable\Admin\V2\ListAppProfilesResponse;
use Google\Cloud\Bigtable\Admin\V2\ListClustersRequest;
use Google\Cloud\Bigtable\Admin\V2\ListClustersResponse;
use Google\Cloud\Bigtable\Admin\V2\ListHotTabletsRequest;
use Google\Cloud\Bigtable\Admin\V2\ListHotTabletsResponse;
use Google\Cloud\Bigtable\Admin\V2\ListInstancesRequest;
use Google\Cloud\Bigtable\Admin\V2\ListInstancesResponse;
use Google\Cloud\Bigtable\Admin\V2\PartialUpdateClusterRequest;
Expand All @@ -73,8 +75,8 @@
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
use Google\LongRunning\Operation;

use Google\Protobuf\FieldMask;

use Google\Protobuf\GPBEmpty;
use Google\Protobuf\Timestamp;

Expand Down Expand Up @@ -1099,6 +1101,95 @@ public function listClusters($parent, array $optionalArgs = [])
return $this->startCall('ListClusters', ListClustersResponse::class, $optionalArgs, $request)->wait();
}

/**
* Lists hot tablets in a cluster, within the time range provided. Hot
* tablets are ordered based on CPU usage.
*
* Sample code:
* ```
* $bigtableInstanceAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient();
* try {
* $formattedParent = $bigtableInstanceAdminClient->clusterName('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
* // Iterate over pages of elements
* $pagedResponse = $bigtableInstanceAdminClient->listHotTablets($formattedParent);
* foreach ($pagedResponse->iteratePages() as $page) {
* foreach ($page as $element) {
* // doSomethingWith($element);
* }
* }
* // Alternatively:
* // Iterate through all elements
* $pagedResponse = $bigtableInstanceAdminClient->listHotTablets($formattedParent);
* foreach ($pagedResponse->iterateAllElements() as $element) {
* // doSomethingWith($element);
* }
* } finally {
* $bigtableInstanceAdminClient->close();
* }
* ```
*
* @param string $parent Required. The cluster name to list hot tablets.
* Value is in the following form:
* `projects/{project}/instances/{instance}/clusters/{cluster}`.
* @param array $optionalArgs {
* Optional.
*
* @type Timestamp $startTime
* The start time to list hot tablets. The hot tablets in the response will
* have start times between the requested start time and end time. Start time
* defaults to Now if it is unset, and end time defaults to Now - 24 hours if
* it is unset. The start time should be less than the end time, and the
* maximum allowed time range between start time and end time is 48 hours.
* Start time and end time should have values between Now and Now - 14 days.
* @type Timestamp $endTime
* The end time to list hot tablets.
* @type int $pageSize
* The maximum number of resources contained in the underlying API
* response. The API may return fewer values in a page, even if
* there are additional values to be retrieved.
* @type string $pageToken
* A page token is used to specify a page of values to be returned.
* If no page token is specified (the default), the first page
* of values will be returned. Any page token used here must have
* been generated by a previous call to the API.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array of retry
* settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* }
*
* @return \Google\ApiCore\PagedListResponse
*
* @throws ApiException if the remote call fails
*/
public function listHotTablets($parent, array $optionalArgs = [])
{
$request = new ListHotTabletsRequest();
$requestParamHeaders = [];
$request->setParent($parent);
$requestParamHeaders['parent'] = $parent;
if (isset($optionalArgs['startTime'])) {
$request->setStartTime($optionalArgs['startTime']);
}

if (isset($optionalArgs['endTime'])) {
$request->setEndTime($optionalArgs['endTime']);
}

if (isset($optionalArgs['pageSize'])) {
$request->setPageSize($optionalArgs['pageSize']);
}

if (isset($optionalArgs['pageToken'])) {
$request->setPageToken($optionalArgs['pageToken']);
}

$requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
$optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
return $this->getPagedListResponse('ListHotTablets', $optionalArgs, ListHotTabletsResponse::class, $request);
}

/**
* Lists information about instances in a project.
*
Expand Down
Loading

0 comments on commit a1986cb

Please sign in to comment.