public final class BigtableDataSettings
Settings class to configure an instance of BigtableDataClient.
Sane defaults are provided for most settings:
- The default service address (bigtable.googleapis.com) and default port (443) are used.
- The transport provider is configured with a channel pool that contains twice as many connections as CPUs.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The only required setting is the instance name.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
BigtableDataSettings.Builder settingsBuilder = BigtableDataSettings.newBuilder()
.setProjectId("my-project")
.setInstanceId("my-instance-id")
.setAppProfileId("default");
BigtableDataSettings settings = builder.build();
For fine grained control of individual RPCs, please refer to EnhancedBigtableStubSettings, which is exposed as Builder#stubSettings().
Static Methods
enableBuiltinMetrics() (deprecated)
public static void enableBuiltinMetrics()
Deprecated. This is a no-op that doesn't do anything. Builtin metrics are enabled by default now. Please refer to BigtableDataSettings.Builder#setMetricsProvider(MetricsProvider) on how to enable or disable built-in metrics.
Register built in metrics.
Exceptions | |
---|---|
Type | Description |
IOException |
enableBuiltinMetrics(Credentials credentials) (deprecated)
public static void enableBuiltinMetrics(Credentials credentials)
Deprecated. This is a no-op that doesn't do anything. Builtin metrics are enabled by default now. Please refer BigtableDataSettings.Builder#setMetricsProvider(MetricsProvider) on how to enable or disable built-in metrics.
Register built in metrics with credentials. The credentials need to have metric write access for all the projects you're publishing to.
Parameter | |
---|---|
Name | Description |
credentials |
com.google.auth.Credentials |
Exceptions | |
---|---|
Type | Description |
IOException |
enableGfeOpenCensusStats()
public static void enableGfeOpenCensusStats()
Enables OpenCensus GFE metric aggregations.
This will register views for gfe_latency and gfe_header_missing_count metrics.
gfe_latency measures the latency between Google's network receives an RPC and reads back the first byte of the response. gfe_header_missing_count is a counter of the number of RPC responses received without the server-timing header.
enableOpenCensusStats()
public static void enableOpenCensusStats()
Enables OpenCensus metric aggregations.
This will register Bigtable client relevant io.opencensus.stats.Views. When coupled with an exporter, it allows users to monitor client behavior.
Please note that in addition to calling this method, the application must:
- Include openensus-impl dependency on the classpath
- Configure an exporter like opencensus-exporter-stats-stackdriver
Example usage for maven:
{@code
Java: {@code StackdriverStatsExporter.createAndRegister(); BigtableDataSettings.enableOpenCensusStats(); }
getMetricsCredentials()
public static Credentials getMetricsCredentials()
Get the metrics credentials if it's set by #enableBuiltinMetrics(Credentials).
Returns | |
---|---|
Type | Description |
com.google.auth.Credentials |
newBuilder()
public static BigtableDataSettings.Builder newBuilder()
Create a new builder.
If emulator configuration provided in BIGTABLE_EMULATOR_HOST environment variable then it creates a builder preconfigured to connect to Bigtable using emulator hostname and port number.
Returns | |
---|---|
Type | Description |
BigtableDataSettings.Builder |
newBuilderForEmulator(int port)
public static BigtableDataSettings.Builder newBuilderForEmulator(int port)
Create a new builder preconfigured to connect to the Bigtable emulator with port number.
Parameter | |
---|---|
Name | Description |
port |
int |
Returns | |
---|---|
Type | Description |
BigtableDataSettings.Builder |
newBuilderForEmulator(String hostname, int port)
public static BigtableDataSettings.Builder newBuilderForEmulator(String hostname, int port)
Creates a new builder preconfigured to connect to the Bigtable emulator with a host name and port number.
Parameters | |
---|---|
Name | Description |
hostname |
String |
port |
int |
Returns | |
---|---|
Type | Description |
BigtableDataSettings.Builder |
Methods
getAppProfileId()
public String getAppProfileId()
Returns the configured AppProfile id to use.
Returns | |
---|---|
Type | Description |
String |
getBatchMutationsTargetRpcLatencyMs()
public Long getBatchMutationsTargetRpcLatencyMs()
Gets target bulk mutation rpc latency if latency based throttling is enabled for BigtableDataClient#newBulkMutationBatcher(String). Otherwise returns null.
Returns | |
---|---|
Type | Description |
Long |
getInstanceId()
public String getInstanceId()
Returns the target instance id.
Returns | |
---|---|
Type | Description |
String |
getMetricsProvider()
public MetricsProvider getMetricsProvider()
Gets the MetricsProvider. *
Returns | |
---|---|
Type | Description |
com.google.cloud.bigtable.data.v2.stub.metrics.MetricsProvider |
getPrimingTableIds() (deprecated)
public List<String> getPrimingTableIds()
Deprecated. This field is ignored. If #isRefreshingChannel() is enabled, warm up requests will be sent to all table ids of the instance.
Returns | |
---|---|
Type | Description |
List<String> |
getProjectId()
public String getProjectId()
Returns the target project id.
Returns | |
---|---|
Type | Description |
String |
getStubSettings()
public EnhancedBigtableStubSettings getStubSettings()
Returns the underlying RPC settings.
Returns | |
---|---|
Type | Description |
EnhancedBigtableStubSettings |
isBulkMutationFlowControlEnabled()
public boolean isBulkMutationFlowControlEnabled()
Gets if flow control is enabled for BigtableDataClient#newBulkMutationBatcher(String) based on the load of the Bigtable server.
Returns | |
---|---|
Type | Description |
boolean |
isLatencyBasedThrottlingForBatchMutationsEnabled()
public boolean isLatencyBasedThrottlingForBatchMutationsEnabled()
Gets if latency based throttling is enabled for BigtableDataClient#newBulkMutationBatcher(String)
Returns | |
---|---|
Type | Description |
boolean |
isRefreshingChannel() (deprecated)
public boolean isRefreshingChannel()
Deprecated. Channel refreshing is enabled by default and this method will be deprecated.
Gets if channels will gracefully refresh connections to Cloud Bigtable service
Returns | |
---|---|
Type | Description |
boolean |
readRowSettings()
public UnaryCallSettings<Query,Row> readRowSettings()
Returns the object with the settings used for point reads via ReadRow.
Returns | |
---|---|
Type | Description |
UnaryCallSettings<Query,Row> |
toBuilder()
public BigtableDataSettings.Builder toBuilder()
Returns a builder containing all the values of this settings class.
Returns | |
---|---|
Type | Description |
BigtableDataSettings.Builder |
toString()
public String toString()
Returns | |
---|---|
Type | Description |
String |