From 7b3adccdf29c9b3c090fd920325d777c9fc01061 Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Thu, 5 Dec 2024 17:04:25 -0500 Subject: [PATCH] doc: improve documentation --- .../data/v2/stub/EnhancedBigtableStubSettings.java | 8 ++++++++ .../stub/metrics/CustomOpenTelemetryMetricsProvider.java | 4 ++++ 2 files changed, 12 insertions(+) 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 5e9e2cfe08..ca3fd97ca9 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 @@ -32,6 +32,7 @@ import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.auth.Credentials; import com.google.bigtable.v2.FeatureFlags; import com.google.bigtable.v2.PingAndWarmRequest; import com.google.cloud.bigtable.Version; @@ -46,6 +47,8 @@ import com.google.cloud.bigtable.data.v2.models.Row; import com.google.cloud.bigtable.data.v2.models.RowMutation; import com.google.cloud.bigtable.data.v2.models.sql.Statement; +import com.google.cloud.bigtable.data.v2.stub.metrics.BuiltinMetricsView; +import com.google.cloud.bigtable.data.v2.stub.metrics.CustomOpenTelemetryMetricsProvider; import com.google.cloud.bigtable.data.v2.stub.metrics.DefaultMetricsProvider; import com.google.cloud.bigtable.data.v2.stub.metrics.MetricsProvider; import com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsBatchingDescriptor; @@ -55,6 +58,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -1035,6 +1039,10 @@ public MetricsProvider getMetricsProvider() { /** * Built-in client side metrics are published through Google Cloud Monitoring endpoint. This * setting overrides the default endpoint for publishing the metrics. + * + *

Note that if you're using {@link CustomOpenTelemetryMetricsProvider}, you should call + * {@link BuiltinMetricsView#registerBuiltinMetrics(Credentials, SdkMeterProviderBuilder, + * String)} to set up the endpoint. */ public Builder setMetricsEndpoint(String endpoint) { this.metricsEndpoint = endpoint; diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CustomOpenTelemetryMetricsProvider.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CustomOpenTelemetryMetricsProvider.java index d728d657ae..24c40446d5 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CustomOpenTelemetryMetricsProvider.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CustomOpenTelemetryMetricsProvider.java @@ -45,6 +45,10 @@ * .setInstanceId("my-instance-id") * .setMetricsProvider(CustomOpenTelemetryMetricsProvider.create(openTelemetry) * .build(); + * + * + * To set up a different credential or endpoint, call + * {@link BuiltinMetricsView#registerBuiltinMetrics(Credentials, SdkMeterProviderBuilder, String)} * } */ public final class CustomOpenTelemetryMetricsProvider implements MetricsProvider {