Skip to content

Comments

chore: refactor otel integration#2794

Open
igorbernstein2 wants to merge 2 commits intomainfrom
csm2-dual-otel
Open

chore: refactor otel integration#2794
igorbernstein2 wants to merge 2 commits intomainfrom
csm2-dual-otel

Conversation

@igorbernstein2
Copy link
Contributor

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.

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 igorbernstein2 requested review from a team as code owners February 20, 2026 20:06
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigtable Issues related to the googleapis/java-bigtable API. labels Feb 20, 2026
*/
@Deprecated
public class BuiltinMetricsView {

Copy link
Contributor Author

@igorbernstein2 igorbernstein2 Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

* 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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to reviewer: this basically inlines the remainder of BuiltinMetricsView. Once we have typesafe metrics this will be stripped as well

Copy link
Contributor

@sushanb sushanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the googleapis/java-bigtable API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants