Skip to content

Commit

Permalink
Merge branch 'main' of github.com:googleapis/java-bigtable into owl-b…
Browse files Browse the repository at this point in the history
…ot-copy
  • Loading branch information
kolea2 committed Apr 22, 2024
2 parents ce7a92b + 3f37d8d commit 4341a77
Show file tree
Hide file tree
Showing 87 changed files with 4,349 additions and 3,693 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unmanaged_dependency_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
shell: bash
run: .kokoro/build.sh
- name: Unmanaged dependency check
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.28.1
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.29.0
with:
bom-path: google-cloud-bigtable-bom/pom.xml
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-17.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.28.1"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.29.0"
}

env_vars: {
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.28.1"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.29.0"
}

env_vars: {
Expand Down
195 changes: 63 additions & 132 deletions .readme-partials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ custom_content: |
TIP: If you are experiencing version conflicts with gRPC, see [Version Conflicts](#version-conflicts).
## Enabling client side metrics
## Client side metrics
Cloud Bigtable client supports publishing client side metrics to
[Cloud Monitoring](https://cloud.google.com/monitoring/docs/monitoring-overview) under the
Expand All @@ -124,6 +124,31 @@ custom_content: |
This feature is available once you upgrade to version 2.16.0 and above.
Follow the guide on https://cloud.google.com/bigtable/docs/client-side-metrics-setup to enable.
Since version 2.38.0, [client side metrics](https://cloud.google.com/bigtable/docs/client-side-metrics)
is enabled by default. This feature collects useful telemetry data in the client and is recommended to
use in conjunction with server-side metrics to get a complete, actionable view of your Bigtable
performance. There is no additional cost to publish and view client-side metrics
in Cloud Monitoring.
### Opt-out client side metrics
You can opt-out client side metrics with the following settings:
```java
BigtableDataSettings settings = BigtableDataSettings.newBuilder()
.setProjectId("my-project")
.setInstanceId("my-instance")
.setMetricsProvider(NoopMetricsProvider.INSTANCE)
.build();
```
### Use a custom OpenTelemetry instance
If your application already has OpenTelemetry integration, you can register client side metrics on
your OpenTelemetry instance. You can refer to
[CustomOpenTelemetryMetricsProvider](https://github.com/googleapis/java-bigtable/blob/main/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CustomOpenTelemetryMetricsProvider.java)
on how to set it up.
## Client request tracing: OpenCensus Tracing
Cloud Bigtable client supports [OpenCensus Tracing](https://opencensus.io/tracing/),
Expand All @@ -138,13 +163,13 @@ custom_content: |
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-impl</artifactId>
<version>0.24.0</version>
<version>0.31.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-exporter-trace-stackdriver</artifactId>
<version>0.24.0</version>
<version>0.31.1</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
Expand Down Expand Up @@ -197,140 +222,46 @@ custom_content: |
);
```
## Enabling Cloud Bigtable Metrics: OpenCensus Stats
---
Note: We recommend [enabling client side built-in metrics](#enabling-client-side-metrics)
if you want to view your metrics on cloud monitoring. This integration is only for exporting the
metrics to a third party dashboard.
---
Cloud Bigtable client supports [Opencensus Metrics](https://opencensus.io/stats/),
which gives insight into the client internals and aids in debugging production issues.
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 of latency of
each client method call, across all of it's RPC attempts. Tagged by
operation name and final response status.
* `cloud.google.com/java/bigtable/completed_ops`: The total count of
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/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.
### Disable Bigtbale traces
* `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.
#### GFE metric views:
* `cloud.google.com/java/bigtable/gfe_latency`: A distribution of the latency
between Google's network receives an RPC and reads back the first byte of
the response.
* `cloud.google.com/java/bigtable/gfe_header_missing_count`: A counter of the
number of RPC responses received without the server-timing header, which
indicates that the request probably never reached Google's network.
By default, the functionality is disabled. For example to enable metrics using
[Google Stackdriver](https://cloud.google.com/monitoring/docs/):
[//]: # (TODO: figure out how to keep opencensus version in sync with pom.xml)
If you are using Maven, add this to your pom.xml file
```xml
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-impl</artifactId>
<version>0.24.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-exporter-stats-stackdriver</artifactId>
<version>0.24.0</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.auth</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
```
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'
```
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"
```
At the start of your application configure the exporter and enable the Bigtable stats views:
If your application already has OpenCensus Tracing integration and you want to disable Bigtable
traces, you can do the following:
```java
import io.opencensus.exporter.stats.stackdriver.StackdriverStatsConfiguration;
import io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter;
StackdriverStatsExporter.createAndRegister(
StackdriverStatsConfiguration.builder()
.setProjectId("YOUR_PROJECT_ID")
.build()
);
BigtableDataSettings.enableOpenCensusStats();
// Enable GFE metric views
BigtableDataSettings.enableGfeOpenCensusStats();
public static class MySampler extends Sampler {
private final Sampler childSampler;
MySampler(Sampler child) {
this.childSampler = child;
}
@Override
public boolean shouldSample(@Nullable SpanContext parentContext,
@Nullable Boolean hasRemoteParent,
TraceId traceId,
SpanId spanId,
String name,
List<Span> parentLinks) {
if (name.contains("Bigtable")) {
return false;
}
return childSampler.shouldSample(parentContext, hasRemoteParent, traceId, spanId, name, parentLinks);
}
@Override
public String getDescription() {
return "from my sampler";
}
}
```
You can view the metrics on the Google Cloud Platform Console
[Metrics explorer](https://console.cloud.google.com/monitoring/metrics-explorer)
page.
You can configure how frequently metrics are pushed to StackDriver and the
[Monitored resource type](https://cloud.google.com/monitoring/api/resources) by
updating `StackdriverStatsConfiguration`:
``` java
// Example: configuring export interval and monitored resource type
StackdriverStatsExporter.createAndRegister(
StackdriverStatsConfiguration.builder()
.setProjectId("YOUR_PROJECT_ID")
// Exporting metrics every 10 seconds
.setExportInterval(Duration.create(10, 0))
// Configure monitored resource type. A common practice is to use the
// monitored resource objects that represent the physical resources
// where your application code is running. See the full list of
// monitored resource type here:
// https://cloud.google.com/monitoring/api/resources
.setMonitoredResource(MonitoredResource.newBuilder()
.setType("global")
.putLabels("project_id", "YOUR_PROJECT_ID")
.build())
.build()
And use this sampler in your trace config:
```java
Tracing.getTraceConfig().updateActiveTraceParams(
Tracing.getTraceConfig().getActiveTraceParams().toBuilder()
.setSampler(new MySampler(Samplers.probabilitySampler(0.1)))
.build()
);
```
Expand Down
3 changes: 2 additions & 1 deletion .repo-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"api_id": "bigtable.googleapis.com",
"library_type": "GAPIC_COMBO",
"extra_versioned_modules": "google-cloud-bigtable-emulator,google-cloud-bigtable-emulator-core",
"excluded_poms": "google-cloud-bigtable-bom"
"excluded_poms": "google-cloud-bigtable-bom",
"recommended_package": "com.google.cloud.bigtable"
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [2.38.0](https://github.com/googleapis/java-bigtable/compare/v2.37.0...v2.38.0) (2024-04-15)


### Features

* Add Data Boost configurations to admin API ([f29c5bb](https://github.com/googleapis/java-bigtable/commit/f29c5bba08daffe2721454db1714f6ea6f47fc66))
* Add feature flag for client side metrics ([#2179](https://github.com/googleapis/java-bigtable/issues/2179)) ([f29c5bb](https://github.com/googleapis/java-bigtable/commit/f29c5bba08daffe2721454db1714f6ea6f47fc66))
* Migrate to OTEL and enable metrics by default ([#2166](https://github.com/googleapis/java-bigtable/issues/2166)) ([1682939](https://github.com/googleapis/java-bigtable/commit/168293937cc7f438a3ec2dee46805aa8e12089c4))


### Bug Fixes

* Add more error handling ([#2203](https://github.com/googleapis/java-bigtable/issues/2203)) ([c2a63f7](https://github.com/googleapis/java-bigtable/commit/c2a63f7627f2aa6e2e51ec3e185abfa5234ad3e4))
* Fix export to log detect resource errors ([#2197](https://github.com/googleapis/java-bigtable/issues/2197)) ([d32fbb7](https://github.com/googleapis/java-bigtable/commit/d32fbb78bbde2ad04103ab7b2c1176a6df72d0a3))

## [2.37.0](https://github.com/googleapis/java-bigtable/compare/v2.36.0...v2.37.0) (2024-03-27)


Expand Down

0 comments on commit 4341a77

Please sign in to comment.