Skip to content

Commit

Permalink
feat: publish the RequestStats proto (#676)
Browse files Browse the repository at this point in the history
* feat: publish the RequestStats proto

PiperOrigin-RevId: 476399682

Source-Link: googleapis/googleapis@0c4e682

Source-Link: googleapis/googleapis-gen@ff87f69
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmY4N2Y2OWFhZDFmMmZmMDY3NzJmOTE3ZWVjYmVhNjQ5Nzk3ZDlkNSJ9

* 🦉 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 Sep 26, 2022
1 parent 1175da5 commit 199949b
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 14 deletions.
10 changes: 10 additions & 0 deletions google/cloud/bigtable_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@
from .types.data import RowSet
from .types.data import TimestampRange
from .types.data import ValueRange
from .types.request_stats import AllReadStats
from .types.request_stats import ReadEfficiencyStats
from .types.request_stats import ReadIteratorStats
from .types.request_stats import RequestLatencyStats
from .types.request_stats import RequestStats
from .types.response_params import ResponseParams

__all__ = (
"BigtableAsyncClient",
"AllReadStats",
"BigtableClient",
"Cell",
"CheckAndMutateRowRequest",
Expand All @@ -61,11 +67,15 @@
"Mutation",
"PingAndWarmRequest",
"PingAndWarmResponse",
"ReadEfficiencyStats",
"ReadIteratorStats",
"ReadModifyWriteRowRequest",
"ReadModifyWriteRowResponse",
"ReadModifyWriteRule",
"ReadRowsRequest",
"ReadRowsResponse",
"RequestLatencyStats",
"RequestStats",
"ResponseParams",
"Row",
"RowFilter",
Expand Down
7 changes: 3 additions & 4 deletions google/cloud/bigtable_v2/services/bigtable/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

from google.cloud.bigtable_v2.types import bigtable
from google.cloud.bigtable_v2.types import data
from google.cloud.bigtable_v2.types import request_stats
from .transports.base import BigtableTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import BigtableGrpcAsyncIOTransport
from .client import BigtableClient
Expand Down Expand Up @@ -238,10 +239,8 @@ def read_rows(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
app_profile_id (:class:`str`):
This value specifies routing for
replication. If not specified, the
"default" application profile will be
used.
This value specifies routing for replication. This API
only accepts the empty value of app_profile_id.
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
7 changes: 3 additions & 4 deletions google/cloud/bigtable_v2/services/bigtable/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

from google.cloud.bigtable_v2.types import bigtable
from google.cloud.bigtable_v2.types import data
from google.cloud.bigtable_v2.types import request_stats
from .transports.base import BigtableTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import BigtableGrpcTransport
from .transports.grpc_asyncio import BigtableGrpcAsyncIOTransport
Expand Down Expand Up @@ -474,10 +475,8 @@ def read_rows(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
app_profile_id (str):
This value specifies routing for
replication. If not specified, the
"default" application profile will be
used.
This value specifies routing for replication. This API
only accepts the empty value of app_profile_id.
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
12 changes: 12 additions & 0 deletions google/cloud/bigtable_v2/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
TimestampRange,
ValueRange,
)
from .request_stats import (
AllReadStats,
ReadEfficiencyStats,
ReadIteratorStats,
RequestLatencyStats,
RequestStats,
)
from .response_params import (
ResponseParams,
)
Expand Down Expand Up @@ -74,5 +81,10 @@
"RowSet",
"TimestampRange",
"ValueRange",
"AllReadStats",
"ReadEfficiencyStats",
"ReadIteratorStats",
"RequestLatencyStats",
"RequestStats",
"ResponseParams",
)
55 changes: 50 additions & 5 deletions google/cloud/bigtable_v2/types/bigtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import proto # type: ignore

from google.cloud.bigtable_v2.types import data
from google.cloud.bigtable_v2.types import request_stats as gb_request_stats
from google.protobuf import wrappers_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore

Expand Down Expand Up @@ -50,9 +51,8 @@ class ReadRowsRequest(proto.Message):
Values are of the form
``projects/<project>/instances/<instance>/tables/<table>``.
app_profile_id (str):
This value specifies routing for replication.
If not specified, the "default" application
profile will be used.
This value specifies routing for replication. This API only
accepts the empty value of app_profile_id.
rows (google.cloud.bigtable_v2.types.RowSet):
The row keys and/or ranges to read
sequentially. If not specified, reads from all
Expand All @@ -65,8 +65,21 @@ class ReadRowsRequest(proto.Message):
The read will stop after committing to N
rows' worth of results. The default (zero) is to
return all results.
request_stats_view (google.cloud.bigtable_v2.types.ReadRowsRequest.RequestStatsView):
The view into RequestStats, as described
above.
"""

class RequestStatsView(proto.Enum):
r"""The desired view into RequestStats that should be returned in
the response.
See also: RequestStats message.
"""
REQUEST_STATS_VIEW_UNSPECIFIED = 0
REQUEST_STATS_NONE = 1
REQUEST_STATS_EFFICIENCY = 2
REQUEST_STATS_FULL = 3

table_name = proto.Field(
proto.STRING,
number=1,
Expand All @@ -89,6 +102,11 @@ class ReadRowsRequest(proto.Message):
proto.INT64,
number=4,
)
request_stats_view = proto.Field(
proto.ENUM,
number=6,
enum=RequestStatsView,
)


class ReadRowsResponse(proto.Message):
Expand All @@ -109,6 +127,28 @@ class ReadRowsResponse(proto.Message):
that was filtered out since the last committed
row key, allowing the client to skip that work
on a retry.
request_stats (google.cloud.bigtable_v2.types.RequestStats):
If requested, provide enhanced query performance statistics.
The semantics dictate:
- request_stats is empty on every (streamed) response,
except
- request_stats has non-empty information after all chunks
have been streamed, where the ReadRowsResponse message
only contains request_stats.
- For example, if a read request would have returned an
empty response instead a single ReadRowsResponse is
streamed with empty chunks and request_stats filled.
Visually, response messages will stream as follows: ... ->
{chunks: [...]} -> {chunks: [], request_stats: {...}}
\_\ **/ \_**\ \__________/ Primary response Trailer of
RequestStats info
Or if the read did not return any values: {chunks: [],
request_stats: {...}} \________________________________/
Trailer of RequestStats info
"""

class CellChunk(proto.Message):
Expand Down Expand Up @@ -232,6 +272,11 @@ class CellChunk(proto.Message):
proto.BYTES,
number=2,
)
request_stats = proto.Field(
proto.MESSAGE,
number=3,
message=gb_request_stats.RequestStats,
)


class SampleRowKeysRequest(proto.Message):
Expand Down Expand Up @@ -370,8 +415,8 @@ class Entry(proto.Message):
Required. Changes to be atomically applied to
the specified row. Mutations are applied in
order, meaning that earlier mutations can be
masked by later ones.
You must specify at least one mutation.
masked by later ones. You must specify at least
one mutation.
"""

row_key = proto.Field(
Expand Down

0 comments on commit 199949b

Please sign in to comment.