public class SpannerOptions extends ServiceOptions<Spanner,SpannerOptions>
Options for the Cloud Spanner service.
Inherited Members
com.google.cloud.ServiceOptions.<B>toBuilder()
com.google.cloud.ServiceOptions.<T>getFromServiceLoader(java.lang.Class<? extends T>,T)
com.google.cloud.ServiceOptions.<T>newInstance(java.lang.String)
com.google.cloud.ServiceOptions.baseEquals(com.google.cloud.ServiceOptions<?,?>)
com.google.cloud.ServiceOptions.baseHashCode()
com.google.cloud.ServiceOptions.defaultRetrySettings()
com.google.cloud.ServiceOptions.getApiTracerFactory()
com.google.cloud.ServiceOptions.getAppEngineAppId()
com.google.cloud.ServiceOptions.getAppEngineProjectId()
com.google.cloud.ServiceOptions.getAppEngineProjectIdFromAppId()
com.google.cloud.ServiceOptions.getApplicationName()
com.google.cloud.ServiceOptions.getClientLibToken()
com.google.cloud.ServiceOptions.getClock()
com.google.cloud.ServiceOptions.getCredentials()
com.google.cloud.ServiceOptions.getDefaultHost()
com.google.cloud.ServiceOptions.getDefaultProject()
com.google.cloud.ServiceOptions.getDefaultProjectId()
com.google.cloud.ServiceOptions.getDefaultRetrySettings()
com.google.cloud.ServiceOptions.getGoogApiClientLibName()
com.google.cloud.ServiceOptions.getGoogleCloudProjectId()
com.google.cloud.ServiceOptions.getHost()
com.google.cloud.ServiceOptions.getLibraryName()
com.google.cloud.ServiceOptions.getLibraryVersion()
com.google.cloud.ServiceOptions.getMergedHeaderProvider(com.google.api.gax.rpc.HeaderProvider)
com.google.cloud.ServiceOptions.getNoRetrySettings()
com.google.cloud.ServiceOptions.getProjectId()
com.google.cloud.ServiceOptions.getQuotaProjectId()
com.google.cloud.ServiceOptions.getResolvedApiaryHost(java.lang.String)
com.google.cloud.ServiceOptions.getResolvedHost(java.lang.String)
com.google.cloud.ServiceOptions.getRetrySettings()
com.google.cloud.ServiceOptions.getRpc()
com.google.cloud.ServiceOptions.getScopedCredentials()
com.google.cloud.ServiceOptions.getScopes()
com.google.cloud.ServiceOptions.getService()
com.google.cloud.ServiceOptions.getServiceAccountProjectId()
com.google.cloud.ServiceOptions.getTransportOptions()
com.google.cloud.ServiceOptions.getUniverseDomain()
com.google.cloud.ServiceOptions.getUserAgent()
com.google.cloud.ServiceOptions.hasValidUniverseDomain()
com.google.cloud.ServiceOptions.projectIdRequired()
com.google.cloud.ServiceOptions.shouldRefreshRpc(com.google.cloud.ServiceRpc)
com.google.cloud.ServiceOptions.shouldRefreshService(ServiceT)
Static Fields
CALL_CONTEXT_CONFIGURATOR_KEY
public static final Context.Key<SpannerOptions.CallContextConfigurator> CALL_CONTEXT_CONFIGURATOR_KEY
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
disableOpenCensusMetrics()
public static void disableOpenCensusMetrics()
Disables OpenCensus metrics. Disable OpenCensus metrics before creating Spanner client.
enableOpenCensusTraces()
public static void enableOpenCensusTraces()
Obsolete
The OpenCensus project is deprecated. Use enableOpenTelemetryTraces to switch to OpenTelemetry traces
This feature is stable for usage in this major version, but may be deprecated in a future release.
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
.
isEnabledOpenCensusMetrics()
public static boolean isEnabledOpenCensusMetrics()
isEnabledOpenTelemetryMetrics()
public static boolean isEnabledOpenTelemetryMetrics()
newBuilder()
public static SpannerOptions.Builder newBuilder()
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.
Constructors
SpannerOptions(SpannerOptions.Builder builder)
protected SpannerOptions(SpannerOptions.Builder builder)
Methods
getApiTracerFactory()
public ApiTracerFactory getApiTracerFactory()
Overrides
com.google.cloud.ServiceOptions.getApiTracerFactory()
getAsyncExecutorProvider()
public SpannerOptions.CloseableExecutorProvider getAsyncExecutorProvider()
getCallCredentialsProvider()
public SpannerOptions.CallCredentialsProvider getCallCredentialsProvider()
getChannelConfigurator()
public ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> getChannelConfigurator()
Returns
Type
Description
ApiFunction <io.grpc.ManagedChannelBuilder ,io.grpc.ManagedChannelBuilder >
getChannelProvider()
public TransportChannelProvider getChannelProvider()
getCompressorName()
public String getCompressorName()
Returns
Type
Description
String
getDatabaseAdminStubSettings()
public DatabaseAdminStubSettings getDatabaseAdminStubSettings()
getDatabaseRole()
public String getDatabaseRole()
Returns
Type
Description
String
getDecodeMode()
public DecodeMode getDecodeMode()
getDefaultHost()
protected String getDefaultHost()
Returns
Type
Description
String
Overrides
com.google.cloud.ServiceOptions.getDefaultHost()
getDefaultProject()
protected String getDefaultProject()
Returns
Type
Description
String
Overrides
com.google.cloud.ServiceOptions.getDefaultProject()
getDefaultQueryOptions(DatabaseId databaseId)
public ExecuteSqlRequest.QueryOptions getDefaultQueryOptions(DatabaseId databaseId)
Returns the default query options to use for the specific database.
getDirectedReadOptions()
public DirectedReadOptions getDirectedReadOptions()
getEndpoint()
public String getEndpoint()
Returns
Type
Description
String
getGrpcGcpOptions()
public GcpManagedChannelOptions getGrpcGcpOptions()
Returns
Type
Description
com.google.cloud.grpc.GcpManagedChannelOptions
getInstanceAdminStubSettings()
public InstanceAdminStubSettings getInstanceAdminStubSettings()
getInterceptorProvider()
public GrpcInterceptorProvider getInterceptorProvider()
getNumChannels()
public int getNumChannels()
Returns
Type
Description
int
getOpenTelemetry()
public OpenTelemetry getOpenTelemetry()
Returns an instance of OpenTelemetry. If OpenTelemetry object is not set via SpannerOptions
then GlobalOpenTelemetry will be used as fallback.
Returns
Type
Description
io.opentelemetry.api.OpenTelemetry
getPartitionedDmlTimeout()
public Duration getPartitionedDmlTimeout()
Returns
Type
Description
org.threeten.bp.Duration
getPrefetchChunks()
public int getPrefetchChunks()
Returns
Type
Description
int
getRetryAdministrativeRequestsSettings()
public RetrySettings getRetryAdministrativeRequestsSettings()
getScopes()
public Set<String> getScopes()
Overrides
com.google.cloud.ServiceOptions.getScopes()
getSessionLabels()
public Map<String,String> getSessionLabels()
getSessionPoolOptions()
public SessionPoolOptions getSessionPoolOptions()
getSpannerRpcV1()
protected SpannerRpc getSpannerRpcV1()
getSpannerStubSettings()
public SpannerStubSettings getSpannerStubSettings()
public String getTransportChannelExecutorThreadNameFormat()
Returns
Type
Description
String
isAttemptDirectPath()
public boolean isAttemptDirectPath()
Beta
This feature is covered by the Pre-GA Offerings Terms of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.
isAutoThrottleAdministrativeRequests()
public boolean isAutoThrottleAdministrativeRequests()
isEnableApiTracing()
public boolean isEnableApiTracing()
Returns true if an com.google.api.gax.tracing.ApiTracer should be created and set on
the Spanner client. Enabling this only has effect if an OpenTelemetry or OpenCensus trace
exporter has been configured.
isEnableExtendedTracing()
public boolean isEnableExtendedTracing()
Returns whether extended OpenTelemetry tracing is enabled. Enabling this option will add the
following additional attributes to the traces that are generated by the client:
db.statement: Contains the SQL statement that is being executed.
thread.name: The name of the thread that executes the statement.
isGrpcGcpExtensionEnabled()
public boolean isGrpcGcpExtensionEnabled()
isLeaderAwareRoutingEnabled()
public boolean isLeaderAwareRoutingEnabled()
isTrackTransactionStarter()
public boolean isTrackTransactionStarter()
isUseVirtualThreads()
public boolean isUseVirtualThreads()
Beta
This feature is covered by the Pre-GA Offerings Terms of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.
shouldRefreshRpc(ServiceRpc cachedRpc)
protected boolean shouldRefreshRpc(ServiceRpc cachedRpc)
Parameter
Name
Description
cachedRpc
com.google.cloud.ServiceRpc
Returns
Type
Description
boolean
true
if the cached ServiceRpc instance is null
or
closed. This will cause the method #getRpc() to create a new Spanner
instance when one is requested.
Overrides
com.google.cloud.ServiceOptions.shouldRefreshRpc(com.google.cloud.ServiceRpc)
shouldRefreshService(Spanner cachedService)
protected boolean shouldRefreshService(Spanner cachedService)
Parameter
Name
Description
cachedService
Spanner
Returns
Type
Description
boolean
true
if the cached Spanner service instance is null
or
closed. This will cause the method #getService() to create a new SpannerRpc
instance when one is requested.
Overrides
com.google.cloud.ServiceOptions.shouldRefreshService(ServiceT)
toBuilder()
public SpannerOptions.Builder toBuilder()
Overrides
com.google.cloud.ServiceOptions.<B>toBuilder()