Class BigtableDataClients
BigtableDataClient at an instance: production over
application-default credentials, production over a runtime-loaded service-account provider, or an
emulator over a plaintext channel with no credentials.
At the module root rather than beside either direction, because every data-client boundary of
this connector takes it — the sink, both sources and the table layer all build the same settings
from the same inputs. The admin clients do not come through here: BigtableTableAdmin and
the Change Streams coordinator build their own settings, and each carries its own copy of the
emulator branch. A second copy of this branch is exactly the thing that reads green on a machine
with credentials and red in CI — the failure ADR-0064 exists to describe.
Only what every path shares lives here. Per-caller tuning — the sink's batch thresholds, and whatever a source may one day need — is applied by the caller on top of the builder this hands back, which is why the return type is the builder rather than the settings.
Retry settings are deliberately untouched, on every path. The client retries
MutateRows per entry, resumes a broken ReadRows stream from the last key it saw, and
resumes a broken ReadChangeStream from its last continuation token. Only a failure that
outlives the client's own retry budget reaches the connector, and on the Change Streams path the
reader turns that into a terminal failure so Flink restarts from the checkpointed token. So
nothing here owns a retry loop, and nothing has a retry knob to map. The single-row request
family is the one caller that touches a call's settings on top of this builder —
DefaultSingleRowClientFactory pins CheckAndMutateRow and ReadModifyWriteRow to a
single attempt under its configured deadline — and it leaves the retryable-code sets as the
client ships them, which for those two RPCs is empty (ADR-0148).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanWhether a client keeps its built-in Cloud Monitoring export when nothing chooses; one place, asDEFAULT_EXPORT_CLIENT_METRICS_TO_FLINKis.static final booleanWhether a component exports its client's own metrics to Flink when nothing chooses: every builder starts from it, and a Table component without a builder resolves an unset option to it, so the default lives in one place (ADR-0139). -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyClientMetrics(com.google.cloud.bigtable.data.v2.BigtableDataSettings.Builder settings, ClientMetrics clientMetrics, boolean exportToCloudMonitoring) Applies the two client-metrics choices to settings built bysettings(io.github.flink.gcp.connector.bigtable.TableDestination, java.lang.String, io.github.flink.gcp.connector.base.rpc.EmulatorEndpoint, com.google.api.gax.core.CredentialsProvider).static StringinstanceKey(TableDestination destination) Returns the key under which every client pool shares one client per instance: the project and instance a destination names, in the one spelling the pools and the per-instance bookkeeping all use.static com.google.cloud.bigtable.data.v2.BigtableDataSettings.Buildersettings(TableDestination destination, String appProfileId, EmulatorEndpoint emulatorEndpoint, com.google.api.gax.core.CredentialsProvider credentialsOverride) Builds the settings for a client that talks to a destination's instance.
-
Field Details
-
DEFAULT_EXPORT_CLIENT_METRICS_TO_FLINK
public static final boolean DEFAULT_EXPORT_CLIENT_METRICS_TO_FLINKWhether a component exports its client's own metrics to Flink when nothing chooses: every builder starts from it, and a Table component without a builder resolves an unset option to it, so the default lives in one place (ADR-0139).- See Also:
-
DEFAULT_EXPORT_CLIENT_METRICS_TO_CLOUD_MONITORING
public static final boolean DEFAULT_EXPORT_CLIENT_METRICS_TO_CLOUD_MONITORINGWhether a client keeps its built-in Cloud Monitoring export when nothing chooses; one place, asDEFAULT_EXPORT_CLIENT_METRICS_TO_FLINKis.- See Also:
-
-
Method Details
-
instanceKey
Returns the key under which every client pool shares one client per instance: the project and instance a destination names, in the one spelling the pools and the per-instance bookkeeping all use.- Parameters:
destination- the table whose instance the key names- Returns:
- the instance key
-
settings
public static com.google.cloud.bigtable.data.v2.BigtableDataSettings.Builder settings(TableDestination destination, @Nullable String appProfileId, @Nullable EmulatorEndpoint emulatorEndpoint, @Nullable com.google.api.gax.core.CredentialsProvider credentialsOverride) Builds the settings for a client that talks to a destination's instance.- Parameters:
destination- the table whose project and instance the client is bound to; the table itself is named per call, not in the settingsappProfileId- the application profile to route through, ornullfor the instance's defaultemulatorEndpoint- the emulator to connect to (plaintext, no credentials), ornullfor production BigtablecredentialsOverride- the runtime-loaded service-account provider, ornullto preserve application-default credentials- Returns:
- the settings builder, for the caller to tune and build
-
applyClientMetrics
public static void applyClientMetrics(com.google.cloud.bigtable.data.v2.BigtableDataSettings.Builder settings, @Nullable ClientMetrics clientMetrics, boolean exportToCloudMonitoring) Applies the two client-metrics choices to settings built bysettings(io.github.flink.gcp.connector.bigtable.TableDestination, java.lang.String, io.github.flink.gcp.connector.base.rpc.EmulatorEndpoint, com.google.api.gax.core.CredentialsProvider).On the classic stub path they are independent in the client (2.85.0,
BigtableClientContext). The built-in Cloud Monitoring exporter is created whenever internal metrics are enabled, whatever the metrics provider; aCustomOpenTelemetryMetricsProvideradds a second recorder beside it rather than replacing it, andNoopMetricsProviderdoes not remove it. So exporting to Flink leaves the Cloud Monitoring export running, and onlydisableInternalMetrics()stops it. The session (vRPC) path that servesReadRowandMutateRowis the exception:MetricsImpl.newTableTracerreturns a no-op tracer when internal metrics are off, so there disabling the Cloud Monitoring export also silences the second recorder.The provider is set on the emulator path too. The emulator builder sets
NoopMetricsProvider, and a later provider replaces it: the client then records against the emulator like any other endpoint, which is what lets an emulator test observe the client's series. The emulator builder has already disabled the Cloud Monitoring export.- Parameters:
settings- the settings to apply them toclientMetrics- the client metrics to record into, ornullto export nothing to FlinkexportToCloudMonitoring- whether the client keeps its built-in Cloud Monitoring export
-