public class SpannerOptions extends ServiceOptions<Spanner,SpannerOptions>
Options for the Cloud Spanner service.
Static Fields
CALL_CONTEXT_CONFIGURATOR_KEY
public static final Context.Key<SpannerOptions.CallContextConfigurator> CALL_CONTEXT_CONFIGURATOR_KEY
Context key for the CallContextConfigurator to use.
Field Value | |
---|---|
Type | Description |
io.grpc.Context.Key<CallContextConfigurator> |
Static Methods
createAsyncExecutorProvider(int poolSize, long keepAliveTime, TimeUnit unit)
public static SpannerOptions.CloseableExecutorProvider createAsyncExecutorProvider(int poolSize, long keepAliveTime, TimeUnit unit)
Creates a CloseableExecutorProvider that can be used as an ExecutorProvider for the async API. The ExecutorProvider will lazily create up to poolSize threads. The backing threads will automatically be shutdown if they have not been used during the keep-alive time. The backing threads are created as daemon threads.
Parameters | |
---|---|
Name | Description |
poolSize |
int the maximum number of threads to create in the pool |
keepAliveTime |
long the time that an unused thread in the pool should be kept alive |
unit |
TimeUnit the time unit used for the keepAliveTime |
Returns | |
---|---|
Type | Description |
SpannerOptions.CloseableExecutorProvider |
a CloseableExecutorProvider that can be used for SpannerOptions.Builder#setAsyncExecutorProvider(CloseableExecutorProvider) |
disableOpenCensusMetrics()
public static void disableOpenCensusMetrics()
Disables OpenCensus metrics. Disable OpenCensus metrics before creating Spanner client.
enableOpenCensusTraces()
public static void enableOpenCensusTraces()
Enables OpenCensus traces. Enabling OpenCensus traces will disable OpenTelemetry traces.
enableOpenTelemetryMetrics()
public static void enableOpenTelemetryMetrics()
Enables OpenTelemetry metrics. Enable OpenTelemetry metrics before creating Spanner client.
enableOpenTelemetryTraces()
public static void enableOpenTelemetryTraces()
Enables OpenTelemetry traces. Enabling OpenTelemetry traces will disable OpenCensus traces. By default, OpenCensus traces are enabled.
getActiveTracingFramework()
public static SpannerOptions.TracingFramework getActiveTracingFramework()
Returns | |
---|---|
Type | Description |
com.google.cloud.spanner.SpannerOptions.TracingFramework |
getDefaultGrpcTransportOptions()
public static GrpcTransportOptions getDefaultGrpcTransportOptions()
Returns | |
---|---|
Type | Description |
com.google.cloud.grpc.GrpcTransportOptions |
getDefaultInstance()
public static SpannerOptions getDefaultInstance()
Returns default instance of SpannerOptions
.
Returns | |
---|---|
Type | Description |
SpannerOptions |
isEnabledOpenCensusMetrics()
public static boolean isEnabledOpenCensusMetrics()
Returns | |
---|---|
Type | Description |
boolean |
isEnabledOpenTelemetryMetrics()
public static boolean isEnabledOpenTelemetryMetrics()
Returns | |
---|---|
Type | Description |
boolean |
newBuilder()
public static SpannerOptions.Builder newBuilder()
Returns | |
---|---|
Type | Description |
SpannerOptions.Builder |
useDefaultEnvironment()
public static void useDefaultEnvironment()
Sets the environment to use to read configuration to the default environment. This will read configuration from environment variables.
useEnvironment(SpannerOptions.SpannerEnvironment environment)
public static void useEnvironment(SpannerOptions.SpannerEnvironment environment)
Sets the environment to use to read configuration. The default will read configuration from environment variables.
Parameter | |
---|---|
Name | Description |
environment |
SpannerOptions.SpannerEnvironment |
Constructors
SpannerOptions(SpannerOptions.Builder builder)
protected SpannerOptions(SpannerOptions.Builder builder)
Parameter | |
---|---|
Name | Description |
builder |
SpannerOptions.Builder |
Methods
getApiTracerFactory()
public ApiTracerFactory getApiTracerFactory()
Returns | |
---|---|
Type | Description |
ApiTracerFactory |
getApiTracerFactory(boolean isAdminClient, boolean isEmulatorEnabled)
public ApiTracerFactory getApiTracerFactory(boolean isAdminClient, boolean isEmulatorEnabled)
Parameters | |
---|---|
Name | Description |
isAdminClient |
boolean |
isEmulatorEnabled |
boolean |
Returns | |
---|---|
Type | Description |
ApiTracerFactory |
getAsyncExecutorProvider()
public SpannerOptions.CloseableExecutorProvider getAsyncExecutorProvider()
Returns | |
---|---|
Type | Description |
SpannerOptions.CloseableExecutorProvider |
getCallCredentialsProvider()
public SpannerOptions.CallCredentialsProvider getCallCredentialsProvider()
Returns | |
---|---|
Type | Description |
SpannerOptions.CallCredentialsProvider |
getChannelConfigurator()
public ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> getChannelConfigurator()
Returns | |
---|---|
Type | Description |
ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder> |
getChannelProvider()
public TransportChannelProvider getChannelProvider()
Returns | |
---|---|
Type | Description |
TransportChannelProvider |
getCompressorName()
public String getCompressorName()
Returns | |
---|---|
Type | Description |
String |
getDatabaseAdminStubSettings()
public DatabaseAdminStubSettings getDatabaseAdminStubSettings()
Returns | |
---|---|
Type | Description |
DatabaseAdminStubSettings |
getDatabaseRole()
public String getDatabaseRole()
Returns | |
---|---|
Type | Description |
String |
getDecodeMode()
public DecodeMode getDecodeMode()
Returns | |
---|---|
Type | Description |
DecodeMode |
getDefaultHost()
protected String getDefaultHost()
Returns | |
---|---|
Type | Description |
String |
getDefaultProject()
protected String getDefaultProject()
Returns | |
---|---|
Type | Description |
String |
getDefaultQueryOptions(DatabaseId databaseId)
public ExecuteSqlRequest.QueryOptions getDefaultQueryOptions(DatabaseId databaseId)
Returns the default query options to use for the specific database.
Parameter | |
---|---|