diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000000..e43d91c0ba
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,10 @@
+# Code owners file.
+# This file controls who is tagged for review for any given pull request.
+#
+# For syntax help see:
+# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
+
+
+# The bigtable-dpe team is the default owner for anything not
+# explicitly taken by someone else.
+* @googleapis/bigtable-dpe
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000000..445b4bf82f
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,76 @@
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+name: ci
+jobs:
+ units:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ java: [7, 8, 11]
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: ${{matrix.java}}
+ - run: java -version
+ - run: .kokoro/build.sh
+ env:
+ JOB_TYPE: test
+ - name: coverage
+ uses: codecov/codecov-action@v1
+ with:
+ name: actions ${{matrix.java}}
+ windows:
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - run: java -version
+ - run: .kokoro/build.bat
+ env:
+ JOB_TYPE: test
+ dependencies:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - run: java -version
+ - run: .kokoro/dependencies.sh
+ linkage-monitor:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - run: java -version
+ - run: .kokoro/linkage-monitor.sh
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - run: java -version
+ - run: .kokoro/build.sh
+ env:
+ JOB_TYPE: lint
+ clirr:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - run: java -version
+ - run: .kokoro/build.sh
+ env:
+ JOB_TYPE: clirr
\ No newline at end of file
diff --git a/.kokoro/build.bat b/.kokoro/build.bat
index 65b013ab16..05826ad93f 100644
--- a/.kokoro/build.bat
+++ b/.kokoro/build.bat
@@ -1,3 +1,3 @@
:: See documentation in type-shell-output.bat
-"C:\Program Files\Git\bin\bash.exe" github/java-bigtable/.kokoro/build.sh
+"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh
diff --git a/.repo-metadata.json b/.repo-metadata.json
index 96bffe6296..b6e5527352 100644
--- a/.repo-metadata.json
+++ b/.repo-metadata.json
@@ -2,7 +2,7 @@
"name": "bigtable",
"name_pretty": "Cloud Bigtable",
"product_documentation": "https://cloud.google.com/bigtable",
- "client_documentation": "https://googleapis.dev/java/java-bigtable/latest/index.html",
+ "client_documentation": "https://googleapis.dev/java/google-cloud-bigtable/latest/index.html",
"issue_tracker": "https://issuetracker.google.com/savedsearches/559777",
"release_level": "ga",
"language": "java",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a79e36c97..30b6e594eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,34 @@
# Changelog
+## [1.13.0](https://www.github.com/googleapis/java-bigtable/compare/v1.12.2...v1.13.0) (2020-05-27)
+
+
+### Features
+
+* adding utility to transform protobuf into model object ([#299](https://www.github.com/googleapis/java-bigtable/issues/299)) ([00f6d2d](https://www.github.com/googleapis/java-bigtable/commit/00f6d2da4179eb3f4f55a1fe1da04047697c5999))
+* expose new API with ReadRowsRequest in EnhancedBigtableStub ([#276](https://www.github.com/googleapis/java-bigtable/issues/276)) ([394efe4](https://www.github.com/googleapis/java-bigtable/commit/394efe459ebe34030bf1d09116eebb4ec4f311e9))
+* Update opencensus metrics to include bigtable resource ids and rpc level metrics ([#214](https://www.github.com/googleapis/java-bigtable/issues/214)) ([7214ef6](https://www.github.com/googleapis/java-bigtable/commit/7214ef6853fc6892401b55bd1beeccbe896e4f33))
+
+
+### Bug Fixes
+
+* bigtable v2 retry config settings to disable streaming RPC retries ([#315](https://www.github.com/googleapis/java-bigtable/issues/315)) ([a7e43f0](https://www.github.com/googleapis/java-bigtable/commit/a7e43f07dc0b93c6702992d45444e815200bf202))
+* change app_profile_id to the correct header app_profile ([#318](https://www.github.com/googleapis/java-bigtable/issues/318)) ([237b15d](https://www.github.com/googleapis/java-bigtable/commit/237b15d14b420005d32f227e1a76e7d308db0a42))
+
+
+### Dependencies
+
+* update autovalue.version to v1.7.2 ([#306](https://www.github.com/googleapis/java-bigtable/issues/306)) ([bc215c5](https://www.github.com/googleapis/java-bigtable/commit/bc215c5883b16727c28893b4a13b3387f0a04ac9))
+* update dependency com.google.api:api-common to v1.9.1 ([#316](https://www.github.com/googleapis/java-bigtable/issues/316)) ([482603a](https://www.github.com/googleapis/java-bigtable/commit/482603acd4c3db461b0e5f489a8c55213b9f3326))
+* update dependency com.google.cloud:google-cloud-conformance-tests to v0.0.11 ([#307](https://www.github.com/googleapis/java-bigtable/issues/307)) ([50a19a6](https://www.github.com/googleapis/java-bigtable/commit/50a19a6aded1b313390ff78b52d9ffc4f4cc7fdd))
+* update dependency com.google.cloud:google-cloud-core-bom to v1.93.5 ([#317](https://www.github.com/googleapis/java-bigtable/issues/317)) ([7f61f90](https://www.github.com/googleapis/java-bigtable/commit/7f61f903abc16554c88850061faf03e6b8beb3b9))
+* update protobuf.version to v3.12.1 ([#308](https://www.github.com/googleapis/java-bigtable/issues/308)) ([99e3a95](https://www.github.com/googleapis/java-bigtable/commit/99e3a95d456bb79841720e8ecbdcb0d47017535e))
+
+
+### Documentation
+
+* **fix:** update client documentation link ([#312](https://www.github.com/googleapis/java-bigtable/issues/312)) ([7e04c7a](https://www.github.com/googleapis/java-bigtable/commit/7e04c7a69a80d71303ce62b4320153facd3cfad8))
+
### [1.12.2](https://www.github.com/googleapis/java-bigtable/compare/v1.12.1...v1.12.2) (2020-05-11)
diff --git a/README.md b/README.md
index 4cfbec85cd..fbfd62da1c 100644
--- a/README.md
+++ b/README.md
@@ -16,16 +16,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloudgoogle-cloud-bigtable
- 1.12.2
+ 1.13.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:google-cloud-bigtable:1.12.2'
+compile 'com.google.cloud:google-cloud-bigtable:1.13.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "1.12.2"
+libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "1.13.0"
```
[//]: # ({x-version-update-end})
@@ -176,13 +176,13 @@ If you are using Maven, add this to your pom.xml file
io.opencensusopencensus-impl
- 0.24.0
+ 0.26.0runtimeio.opencensusopencensus-exporter-trace-stackdriver
- 0.24.0
+ 0.26.0io.grpc
@@ -197,13 +197,13 @@ If you are using Maven, add this to your pom.xml file
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'io.opencensus:opencensus-impl:0.24.0'
-compile 'io.opencensus:opencensus-exporter-trace-stackdriver:0.24.0'
+compile 'io.opencensus:opencensus-impl:0.26.0'
+compile 'io.opencensus:opencensus-exporter-trace-stackdriver:0.26.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "io.opencensus" % "opencensus-impl" % "0.24.0"
-libraryDependencies += "io.opencensus" % "opencensus-exporter-trace-stackdriver" % "0.24.0"
+libraryDependencies += "io.opencensus" % "opencensus-impl" % "0.26.0"
+libraryDependencies += "io.opencensus" % "opencensus-exporter-trace-stackdriver" % "0.26.0"
```
At the start of your application configure the exporter:
@@ -236,30 +236,37 @@ Tracing.getTraceConfig().updateActiveTraceParams(
Cloud Bigtable client supports [Opencensus Metrics](https://opencensus.io/stats/),
which gives insight into the client internals and aids in debugging production issues.
-Metrics prefixed with `cloud.google.com/java/bigtable/` focus on operation level
-metrics across all of the retry attempts that occurred during that operation. RPC
-level metrics can be gleaned from gRPC's metrics, which are prefixed with
-`grpc.io/client/`.
+All Cloud Bigtable Metrics are prefixed with `cloud.google.com/java/bigtable/`. The
+metrics will be tagged with:
+ * `bigtable_project_id`: the project that contains the target Bigtable instance.
+ Please note that this id could be different from project that the client is running
+ in and different from the project where the metrics are exported to.
+* `bigtable_instance_id`: the instance id of the target Bigtable instance
+* `bigtable_app_profile_id`: the app profile id that is being used to access the target
+ Bigtable instance
### Available operation level metric views:
-* `cloud.google.com/java/bigtable/op_latency`: A distribution latency of
+* `cloud.google.com/java/bigtable/op_latency`: A distribution of latency of
each client method call, across all of it's RPC attempts. Tagged by
- method name and final response status.
+ operation name and final response status.
* `cloud.google.com/java/bigtable/completed_ops`: The total count of
- method invocations. Tagged by method name. Can be compared to
- `grpc.io/client/completed_rpcs` to visualize retry attempts.
+ method invocations. Tagged by operation name and final response status.
* `cloud.google.com/java/bigtable/read_rows_first_row_latency`: A
distribution of the latency of receiving the first row in a ReadRows
operation.
-* `cloud.google.com/java/bigtable/rows_per_op`: A distribution of rows
- read per ReadRows operation across all retry attempts.
+* `cloud.google.com/java/bigtable/attempt_latency`: A distribution of latency of
+ each client RPC, tagged by operation name and the attempt status. Under normal
+ circumstances, this will be identical to op_latency. However, when the client
+ receives transient errors, op_latency will be the sum of all attempt_latencies
+ and the exponential delays
-* `cloud.google.com/java/bigtable/mutations_per_batch`: A distribution
- of mutations per BulkMutation.
+* `cloud.google.com/java/bigtable/attempts_per_op`: A distribution of attempts that
+ each operation required, tagged by operation name and final operation status.
+ Under normal circumstances, this will be 1.
By default, the functionality is disabled. For example to enable metrics using
@@ -273,13 +280,13 @@ If you are using Maven, add this to your pom.xml file
io.opencensusopencensus-impl
- 0.24.0
+ 0.26.0runtimeio.opencensusopencensus-exporter-stats-stackdriver
- 0.24.0
+ 0.26.0io.grpc
@@ -294,13 +301,13 @@ If you are using Maven, add this to your pom.xml file
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'io.opencensus:opencensus-impl:0.24.0'
-compile 'io.opencensus:opencensus-exporter-stats-stackdriver:0.24.0'
+compile 'io.opencensus:opencensus-impl:0.26.0'
+compile 'io.opencensus:opencensus-exporter-stats-stackdriver:0.26.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "io.opencensus" % "opencensus-impl" % "0.24.0"
-libraryDependencies += "io.opencensus" % "opencensus-exporter-stats-stackdriver" % "0.24.0"
+libraryDependencies += "io.opencensus" % "opencensus-impl" % "0.26.0"
+libraryDependencies += "io.opencensus" % "opencensus-exporter-stats-stackdriver" % "0.26.0"
```
At the start of your application configure the exporter and enable the Bigtable stats views:
@@ -337,7 +344,7 @@ Add the following to your project's pom.xml.
io.grpcgrpc-bom
- 1.27.0
+ 1.28.0pomimport
diff --git a/google-cloud-bigtable-bom/pom.xml b/google-cloud-bigtable-bom/pom.xml
index f345024f81..370f6cccec 100644
--- a/google-cloud-bigtable-bom/pom.xml
+++ b/google-cloud-bigtable-bom/pom.xml
@@ -3,12 +3,12 @@
4.0.0com.google.cloudgoogle-cloud-bigtable-bom
- 1.12.2
+ 1.13.0pomcom.google.cloudgoogle-cloud-shared-config
- 0.5.0
+ 0.6.0Google Cloud Bigtable BOM
@@ -72,32 +72,32 @@
com.google.cloudgoogle-cloud-bigtable
- 1.12.2
+ 1.13.0com.google.cloudgoogle-cloud-bigtable-emulator
- 0.121.2
+ 0.122.0com.google.api.grpcgrpc-google-cloud-bigtable-admin-v2
- 1.12.2
+ 1.13.0com.google.api.grpcgrpc-google-cloud-bigtable-v2
- 1.12.2
+ 1.13.0com.google.api.grpcproto-google-cloud-bigtable-admin-v2
- 1.12.2
+ 1.13.0com.google.api.grpcproto-google-cloud-bigtable-v2
- 1.12.2
+ 1.13.0
diff --git a/google-cloud-bigtable-deps-bom/pom.xml b/google-cloud-bigtable-deps-bom/pom.xml
index e8a0eee81f..3b071292b8 100644
--- a/google-cloud-bigtable-deps-bom/pom.xml
+++ b/google-cloud-bigtable-deps-bom/pom.xml
@@ -7,12 +7,12 @@
com.google.cloudgoogle-cloud-shared-config
- 0.5.0
+ 0.6.0com.google.cloudgoogle-cloud-bigtable-deps-bom
- 1.12.2
+ 1.13.0pom
@@ -71,19 +71,19 @@
- 1.7.1
+ 1.7.21.56.0
- 1.9.0
+ 1.9.11.18.0
- 1.93.4
+ 1.93.50.20.01.35.01.29.029.0-android0.26.0
- 3.11.4
+ 3.12.11.4.4
@@ -190,6 +190,11 @@
opencensus-api${opencensus.version}
+
+ io.opencensus
+ opencensus-impl-core
+ ${opencensus.version}
+ io.opencensusopencensus-contrib-grpc-util
diff --git a/google-cloud-bigtable-emulator/pom.xml b/google-cloud-bigtable-emulator/pom.xml
index 3576992f97..9846bc7e10 100644
--- a/google-cloud-bigtable-emulator/pom.xml
+++ b/google-cloud-bigtable-emulator/pom.xml
@@ -5,7 +5,7 @@
4.0.0google-cloud-bigtable-emulator
- 0.121.2
+ 0.122.0Google Cloud Java - Bigtable Emulatorhttps://github.com/googleapis/java-bigtable
@@ -14,7 +14,7 @@
com.google.cloudgoogle-cloud-bigtable-parent
- 1.12.2
+ 1.13.0scm:git:git@github.com:googleapis/java-bigtable.git
@@ -80,14 +80,14 @@
com.google.cloudgoogle-cloud-bigtable-deps-bom
- 1.12.2
+ 1.13.0pomimportcom.google.cloudgoogle-cloud-bigtable-bom
- 1.12.2
+ 1.13.0pomimport
diff --git a/google-cloud-bigtable/clirr-ignored-differences.xml b/google-cloud-bigtable/clirr-ignored-differences.xml
index 9dec1aa01d..ab921a973f 100644
--- a/google-cloud-bigtable/clirr-ignored-differences.xml
+++ b/google-cloud-bigtable/clirr-ignored-differences.xml
@@ -7,4 +7,20 @@
*snapshot**snapshot*
+
+ 8001
+ com/google/cloud/bigtable/data/v2/stub/metrics/MeasuredMutateRowsCallable*
+
+
+ 8001
+ com/google/cloud/bigtable/data/v2/stub/metrics/MeasuredReadRowsCallable*
+
+
+ 8001
+ com/google/cloud/bigtable/data/v2/stub/metrics/MeasuredUnaryCallable*
+
+
+ 8001
+ com/google/cloud/bigtable/gaxx/tracing/WrappedTracerFactory*
+
\ No newline at end of file
diff --git a/google-cloud-bigtable/pom.xml b/google-cloud-bigtable/pom.xml
index c4c7609845..d33c079274 100644
--- a/google-cloud-bigtable/pom.xml
+++ b/google-cloud-bigtable/pom.xml
@@ -2,7 +2,7 @@
4.0.0google-cloud-bigtable
- 1.12.2
+ 1.13.0jarGoogle Cloud Bigtablehttps://github.com/googleapis/java-bigtable
@@ -12,7 +12,7 @@
com.google.cloudgoogle-cloud-bigtable-parent
- 1.12.2
+ 1.13.0google-cloud-bigtable
@@ -36,14 +36,14 @@
com.google.cloudgoogle-cloud-bigtable-deps-bom
- 1.12.2
+ 1.13.0pomimportcom.google.cloudgoogle-cloud-bigtable-bom
- 1.12.2
+ 1.13.0pomimport
@@ -172,12 +172,6 @@
org.threetenthreetenbp
-
-
-
-
-
-
@@ -218,6 +212,11 @@
grpc-testingtest
+
+ io.opencensus
+ opencensus-impl
+ test
+ junitjunit
@@ -385,8 +384,12 @@
io.grpc:grpc-auth,io.grpc:grpc-grpclb,com.google.auto.value:auto-value
+
+ io.opencensus:opencensus-impl-core
+
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java
index fb45e8e458..95d10872ec 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.bigtable.data.v2.models;
+import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.bigtable.v2.MutateRowsRequest;
import com.google.cloud.bigtable.data.v2.internal.NameUtil;
@@ -114,6 +115,26 @@ public MutateRowsRequest toProto(RequestContext requestContext) {
.build();
}
+ /**
+ * Wraps the protobuf {@link MutateRowsRequest}.
+ *
+ *
This is meant for advanced usage only. Please ensure that the MutateRowsRequest does not use
+ * server side timestamps. The BigtableDataClient assumes that mutation present in BulkMutation
+ * are idempotent and is configured to enable retries by default. If serverside timestamps are
+ * enabled then that can lead to duplicate mutations.
+ *
+ *
WARNING: when applied, the resulting mutation object will ignore the project id and instance
+ * id in the table_name and instead apply the configuration in the client.
+ */
+ @BetaApi
+ public static BulkMutation fromProto(@Nonnull MutateRowsRequest request) {
+ BulkMutation bulkMutation =
+ BulkMutation.create(NameUtil.extractTableIdFromTableName(request.getTableName()));
+ bulkMutation.builder = request.toBuilder();
+
+ return bulkMutation;
+ }
+
/** Creates a copy of {@link BulkMutation}. */
@Override
public BulkMutation clone() {
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutation.java
index 15cc2be1f4..ac4c548942 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutation.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutation.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.bigtable.data.v2.models;
+import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.bigtable.v2.CheckAndMutateRowRequest;
import com.google.cloud.bigtable.data.v2.internal.NameUtil;
@@ -136,4 +137,20 @@ public CheckAndMutateRowRequest toProto(RequestContext requestContext) {
.setAppProfileId(requestContext.getAppProfileId())
.build();
}
+
+ /**
+ * Wraps the protobuf {@link CheckAndMutateRowRequest}.
+ *
+ *
WARNING: Please note that the table_name will be overwritten by the configuration in the
+ * BigtableDataClient.
+ */
+ @BetaApi
+ public static ConditionalRowMutation fromProto(@Nonnull CheckAndMutateRowRequest request) {
+ String tableId = NameUtil.extractTableIdFromTableName(request.getTableName());
+ ConditionalRowMutation rowMutation =
+ ConditionalRowMutation.create(tableId, request.getRowKey());
+ rowMutation.builder = request.toBuilder();
+
+ return rowMutation;
+ }
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java
index 2a6b655ee4..326d78cfe0 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java
@@ -87,6 +87,22 @@ public static Mutation fromProtoUnsafe(List pro
return mutation;
}
+ /**
+ * Constructs a row mutation from an existing protobuf object.
+ *
+ *
Callers must ensure that the protobuf argument is not using serverside timestamps. The
+ * client assumes that all mutations are idempotent and will retry in case of transient errors.
+ * This can lead to row duplication.
+ *
+ *
When applied, the resulting Mutation object will ignore the project id and instance id in
+ * the table_name and instead apply the configuration in the client
+ */
+ static Mutation fromProto(List protos) {
+ Mutation mutation = new Mutation(false);
+ mutation.mutations.addAll(protos);
+ return mutation;
+ }
+
private Mutation(boolean allowServersideTimestamp) {
this.allowServersideTimestamp = allowServersideTimestamp;
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRow.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRow.java
index 26253b9cbc..5fa483d1bd 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRow.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRow.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.bigtable.data.v2.models;
+import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.bigtable.v2.ReadModifyWriteRowRequest;
import com.google.bigtable.v2.ReadModifyWriteRule;
@@ -137,4 +138,20 @@ public ReadModifyWriteRowRequest toProto(RequestContext requestContext) {
.setAppProfileId(requestContext.getAppProfileId())
.build();
}
+
+ /**
+ * Wraps the protobuf {@link ReadModifyWriteRowRequest}.
+ *
+ *
WARNING: Please note that the table_name will be overwritten by the configuration in the
+ * BigtableDataClient.
+ */
+ @BetaApi
+ public static ReadModifyWriteRow fromProto(@Nonnull ReadModifyWriteRowRequest request) {
+ String tableId = NameUtil.extractTableIdFromTableName(request.getTableName());
+
+ ReadModifyWriteRow row = ReadModifyWriteRow.create(tableId, request.getRowKey());
+ row.builder = request.toBuilder();
+
+ return row;
+ }
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutation.java
index 37b658e8c9..6c5456aac3 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutation.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutation.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.bigtable.data.v2.models;
+import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.bigtable.v2.MutateRowRequest;
import com.google.bigtable.v2.MutateRowsRequest;
@@ -214,4 +215,23 @@ public MutateRowsRequest toBulkProto(RequestContext requestContext) {
Entry.newBuilder().setRowKey(key).addAllMutations(mutation.getMutations()).build())
.build();
}
+
+ /**
+ * Wraps the protobuf {@link MutateRowRequest}.
+ *
+ *
This is meant for advanced usage only. Please ensure that the MutateRowRequest does not use
+ * server side timestamps. The BigtableDataClient assumes that RowMutations are idempotent and is
+ * configured to enable retries by default. If serverside timestamps are enabled, this can lead to
+ * duplicate mutations.
+ *
+ *
Dispatch the RPC with {@link ReadRowsRequest}.
+ *
Upon receiving the response stream, it will merge the {@link
+ * com.google.bigtable.v2.ReadRowsResponse.CellChunk}s in logical rows. The actual row
+ * implementation can be configured by the {@code rowAdapter} parameter.
+ *
Retry/resume on failure.
+ *
Filter out marker rows.
+ *
+ *
+ *
NOTE: the caller is responsible for adding tracing & metrics.
+ */
+ @BetaApi("This surface is stable yet it might be removed in the future.")
+ public ServerStreamingCallable createReadRowsRawCallable(
+ RowAdapter rowAdapter) {
+ return createReadRowsBaseCallable(settings.readRowsSettings(), rowAdapter)
+ .withDefaultCallContext(clientContext.getDefaultCallContext());
+ }
+
/**
* Creates a callable chain to handle streaming ReadRows RPCs. The chain will:
*
@@ -164,24 +231,19 @@ private EnhancedBigtableStub(
*/
public ServerStreamingCallable createReadRowsCallable(
RowAdapter rowAdapter) {
- ServerStreamingCallable readRowsCallable =
+ ServerStreamingCallable readRowsCallable =
createReadRowsBaseCallable(settings.readRowsSettings(), rowAdapter);
+ ServerStreamingCallable readRowsUserCallable =
+ new ReadRowsUserCallable<>(readRowsCallable, requestContext);
+
ServerStreamingCallable traced =
new TracedServerStreamingCallable<>(
- readRowsCallable,
+ readRowsUserCallable,
clientContext.getTracerFactory(),
- SpanName.of(TRACING_OUTER_CLIENT_NAME, "ReadRows"));
-
- ServerStreamingCallable measured =
- new MeasuredReadRowsCallable<>(
- traced,
- TRACING_OUTER_CLIENT_NAME + ".ReadRows",
- tagger,
- statsRecorder,
- clientContext.getClock());
+ SpanName.of(CLIENT_NAME, "ReadRows"));
- return measured.withDefaultCallContext(clientContext.getDefaultCallContext());
+ return traced.withDefaultCallContext(clientContext.getDefaultCallContext());
}
/**
@@ -199,15 +261,17 @@ public ServerStreamingCallable createReadRowsCallable(
*
*/
public UnaryCallable createReadRowCallable(RowAdapter rowAdapter) {
- UnaryCallable readRowCallable =
+ ServerStreamingCallable readRowsCallable =
createReadRowsBaseCallable(
- ServerStreamingCallSettings.newBuilder()
- .setRetryableCodes(settings.readRowSettings().getRetryableCodes())
- .setRetrySettings(settings.readRowSettings().getRetrySettings())
- .setIdleTimeout(settings.readRowSettings().getRetrySettings().getTotalTimeout())
- .build(),
- rowAdapter)
- .first();
+ ServerStreamingCallSettings.newBuilder()
+ .setRetryableCodes(settings.readRowSettings().getRetryableCodes())
+ .setRetrySettings(settings.readRowSettings().getRetrySettings())
+ .setIdleTimeout(settings.readRowSettings().getRetrySettings().getTotalTimeout())
+ .build(),
+ rowAdapter);
+
+ UnaryCallable readRowCallable =
+ new ReadRowsUserCallable<>(readRowsCallable, requestContext).first();
return createUserFacingUnaryCallable("ReadRow", readRowCallable);
}
@@ -216,19 +280,18 @@ public UnaryCallable createReadRowCallable(RowAdapter
* Creates a callable chain to handle ReadRows RPCs. The chain will:
*
*
- *
Convert a {@link Query} into a {@link com.google.bigtable.v2.ReadRowsRequest} and
- * dispatch the RPC.
+ *
Dispatch the RPC with {@link ReadRowsRequest}.
*
Upon receiving the response stream, it will merge the {@link
* com.google.bigtable.v2.ReadRowsResponse.CellChunk}s in logical rows. The actual row
- * implementation can be configured in by the {@code rowAdapter} parameter.
+ * implementation can be configured by the {@code rowAdapter} parameter.
*
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java
index ce8b4bb2b1..139e7c2233 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java
@@ -20,9 +20,7 @@
import com.google.api.gax.batching.BatchingSettings;
import com.google.api.gax.batching.FlowControlSettings;
import com.google.api.gax.batching.FlowController.LimitExceededBehavior;
-import com.google.api.gax.core.GaxProperties;
import com.google.api.gax.core.GoogleCredentialsProvider;
-import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ServerStreamingCallSettings;
@@ -30,7 +28,6 @@
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
-import com.google.api.gax.tracing.OpencensusTracerFactory;
import com.google.cloud.bigtable.data.v2.internal.RefreshChannel;
import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation;
import com.google.cloud.bigtable.data.v2.models.KeyOffset;
@@ -42,7 +39,6 @@
import com.google.cloud.bigtable.data.v2.stub.readrows.ReadRowsBatchingDescriptor;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.List;
import java.util.Set;
@@ -522,13 +518,6 @@ private Builder() {
setInternalHeaderProvider(
BigtableStubSettings.defaultApiClientHeaderProviderBuilder().build());
- setTracerFactory(
- new OpencensusTracerFactory(
- ImmutableMap.of(
- "gax", GaxGrpcProperties.getGaxGrpcVersion(),
- "grpc", GaxGrpcProperties.getGrpcVersion(),
- "gapic", GaxProperties.getLibraryVersion(EnhancedBigtableStubSettings.class))));
-
// Per-method settings using baseSettings for defaults.
readRowsSettings = ServerStreamingCallSettings.newBuilder();
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracer.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracer.java
new file mode 100644
index 0000000000..33bf9c42b9
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracer.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.cloud.bigtable.data.v2.stub.metrics;
+
+import com.google.api.gax.tracing.ApiTracer;
+import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
+import java.util.List;
+import org.threeten.bp.Duration;
+
+/** Combines multiple {@link ApiTracer}s into a single {@link ApiTracer}. */
+class CompositeTracer implements ApiTracer {
+ private final List children;
+
+ CompositeTracer(List children) {
+ this.children = ImmutableList.copyOf(children);
+ }
+
+ @Override
+ public Scope inScope() {
+ final List childScopes = new ArrayList<>(children.size());
+
+ for (ApiTracer child : children) {
+ childScopes.add(child.inScope());
+ }
+
+ return new Scope() {
+ @Override
+ public void close() {
+ for (Scope childScope : childScopes) {
+ childScope.close();
+ }
+ }
+ };
+ }
+
+ @Override
+ public void operationSucceeded() {
+ for (ApiTracer child : children) {
+ child.operationSucceeded();
+ }
+ }
+
+ @Override
+ public void operationCancelled() {
+ for (ApiTracer child : children) {
+ child.operationCancelled();
+ }
+ }
+
+ @Override
+ public void operationFailed(Throwable error) {
+ for (ApiTracer child : children) {
+ child.operationFailed(error);
+ }
+ }
+
+ @Override
+ public void connectionSelected(String id) {
+ for (ApiTracer child : children) {
+ child.connectionSelected(id);
+ }
+ }
+
+ @Override
+ public void attemptStarted(int attemptNumber) {
+ for (ApiTracer child : children) {
+ child.attemptStarted(attemptNumber);
+ }
+ }
+
+ @Override
+ public void attemptSucceeded() {
+ for (ApiTracer child : children) {
+ child.attemptSucceeded();
+ }
+ }
+
+ @Override
+ public void attemptCancelled() {
+ for (ApiTracer child : children) {
+ child.attemptCancelled();
+ }
+ }
+
+ @Override
+ public void attemptFailed(Throwable error, Duration delay) {
+ for (ApiTracer child : children) {
+ child.attemptFailed(error, delay);
+ }
+ }
+
+ @Override
+ public void attemptFailedRetriesExhausted(Throwable error) {
+ for (ApiTracer child : children) {
+ child.attemptFailedRetriesExhausted(error);
+ }
+ }
+
+ @Override
+ public void attemptPermanentFailure(Throwable error) {
+ for (ApiTracer child : children) {
+ child.attemptPermanentFailure(error);
+ }
+ }
+
+ @Override
+ public void lroStartFailed(Throwable error) {
+ for (ApiTracer child : children) {
+ child.lroStartFailed(error);
+ }
+ }
+
+ @Override
+ public void lroStartSucceeded() {
+ for (ApiTracer child : children) {
+ child.lroStartSucceeded();
+ }
+ }
+
+ @Override
+ public void responseReceived() {
+ for (ApiTracer child : children) {
+ child.responseReceived();
+ }
+ }
+
+ @Override
+ public void requestSent() {
+ for (ApiTracer child : children) {
+ child.requestSent();
+ }
+ }
+
+ @Override
+ public void batchRequestSent(long elementCount, long requestSize) {
+ for (ApiTracer child : children) {
+ child.batchRequestSent(elementCount, requestSize);
+ }
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/tracing/WrappedTracerFactory.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracerFactory.java
similarity index 50%
rename from google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/tracing/WrappedTracerFactory.java
rename to google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracerFactory.java
index 253d7a207a..e2e399ae3d 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/tracing/WrappedTracerFactory.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Google LLC
+ * Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,36 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.google.cloud.bigtable.gaxx.tracing;
+package com.google.cloud.bigtable.data.v2.stub.metrics;
import com.google.api.core.InternalApi;
import com.google.api.gax.tracing.ApiTracer;
import com.google.api.gax.tracing.ApiTracerFactory;
import com.google.api.gax.tracing.SpanName;
+import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
+import java.util.List;
-/**
- * Simple wrapper around {@link ApiTracerFactory} to augment the client name of the generated
- * traces.
- *
- *
This is used to disambiguate traces in underlying GAPIC client from the manually written
- * overlay.
- *
- *
For internal use, public for technical reasons.
- */
-@InternalApi
-public class WrappedTracerFactory implements ApiTracerFactory {
- private final ApiTracerFactory innerFactory;
- private final String clientName;
+/** Combines multiple {@link ApiTracerFactory} into a single {@link ApiTracerFactory}. */
+@InternalApi("For internal use only")
+public class CompositeTracerFactory implements ApiTracerFactory {
+ private final List apiTracerFactories;
- public WrappedTracerFactory(ApiTracerFactory tracerFactory, String clientName) {
- this.innerFactory = tracerFactory;
- this.clientName = clientName;
+ public CompositeTracerFactory(List apiTracerFactories) {
+ this.apiTracerFactories = ImmutableList.copyOf(apiTracerFactories);
}
@Override
public ApiTracer newTracer(ApiTracer parent, SpanName spanName, OperationType operationType) {
- spanName = SpanName.of(clientName, spanName.getMethodName());
+ List children = new ArrayList<>(apiTracerFactories.size());
- return innerFactory.newTracer(parent, spanName, operationType);
+ for (ApiTracerFactory factory : apiTracerFactories) {
+ children.add(factory.newTracer(parent, spanName, operationType));
+ }
+ return new CompositeTracer(children);
}
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/MeasuredMutateRowsCallable.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/MeasuredMutateRowsCallable.java
deleted file mode 100644
index 11878635fe..0000000000
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/MeasuredMutateRowsCallable.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.google.cloud.bigtable.data.v2.stub.metrics;
-
-import com.google.api.core.ApiClock;
-import com.google.api.core.ApiFuture;
-import com.google.api.core.InternalApi;
-import com.google.api.gax.rpc.ApiCallContext;
-import com.google.api.gax.rpc.UnaryCallable;
-import com.google.cloud.bigtable.data.v2.models.BulkMutation;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.MoreExecutors;
-import io.opencensus.stats.StatsRecorder;
-import io.opencensus.tags.TagContext;
-import io.opencensus.tags.TagValue;
-import io.opencensus.tags.Tagger;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-
-/**
- * This callable will instrument MutateRows invocations using OpenCensus stats.
- *
- *