chore: refactor otel integration#2794
Merged
igorbernstein2 merged 2 commits intomainfrom Feb 22, 2026
Merged
Conversation
Previously bigtable client would construct 2 otel instances: - one for internal metrics not relevant for customers - another for user visible metrics The 2nd otel instance would be used for both exporting to cloud monitoring and to end user provided exporters. This was done by having the enduser provide a SdkMeterProviderBuilder and use a utility to inject the bigtable builtin exporter. This created a number of problems and overheads. This PR changes the split, now there is a builtin otel instance with a bigtable exporter preconfigured. This receives both internal and user visible cloud monitoring metrics. This exporter can be disabled via EnhancedStubSettings#disableInternalMetrics() In addition, if an enduser provides their own otel instance via CustomOpenTelemetryMetricsProvider, this will be dual written in parallel to the builtin one. Now the default case is that we have 1 otel instance and we dont have to inject our internal exporter into the use otel instance. Change-Id: Ic0b8efdcdf342aef8f589c2c9e05b7672a0e5d08
Change-Id: Id8a2052a4d49a9623a2b63debe1f8ef10210f84c
igorbernstein2
commented
Feb 20, 2026
...ain/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableCloudMonitoringExporter.java
Show resolved
Hide resolved
igorbernstein2
commented
Feb 20, 2026
| */ | ||
| @Deprecated | ||
| public class BuiltinMetricsView { | ||
|
|
Contributor
Author
There was a problem hiding this comment.
note to reviewer: this class not used anymore but since its marked public I left the bare minimum: just register the otel views and not try to register the exporter. So all exporter related args are just ignored now
igorbernstein2
commented
Feb 20, 2026
...igtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsView.java
Show resolved
Hide resolved
igorbernstein2
commented
Feb 20, 2026
| * Convenient method to set up SdkMeterProviderBuilder with the default credential and endpoint. | ||
| */ | ||
| public static void setupSdkMeterProvider(SdkMeterProviderBuilder builder) throws IOException { | ||
| setupSdkMeterProvider(builder, null, null, null); |
Contributor
Author
There was a problem hiding this comment.
note to reviewer: this basically inlines the remainder of BuiltinMetricsView. Once we have typesafe metrics this will be stripped as well
igorbernstein2
commented
Feb 20, 2026
...ble/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/DefaultMetricsProvider.java
Show resolved
Hide resolved
igorbernstein2
commented
Feb 20, 2026
...oud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableClientContext.java
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously bigtable client would construct 2 otel instances:
The 2nd otel instance would be used for both exporting to cloud monitoring and to end user provided exporters.
This was done by having the enduser provide a SdkMeterProviderBuilder and use a utility to inject the bigtable builtin exporter.
This created a number of problems and overheads.
This PR changes the split, now there is a builtin otel instance with a bigtable exporter preconfigured. This receives both internal and user visible cloud monitoring metrics.
This exporter can be disabled via EnhancedStubSettings#disableInternalMetrics()
In addition, if an enduser provides their own otel instance via CustomOpenTelemetryMetricsProvider, this will be dual written in parallel to the builtin one.
Now the default case is that we have 1 otel instance and we dont have to inject our internal exporter into the use otel instance.