Skip to content

.setBuiltInMetricsEnabled(false) simply has no effect #4355

@kberezin-nshl

Description

@kberezin-nshl

Startup logs:

2026-02-15 13:04:33.932 CET
SpannerClient is getting created...
Feb 15, 2026 12:04:34 PM com.google.cloud.grpc.GcpManagedChannel initMetrics
INFO: pool-1: OpenTelemetry meter detected. Using OpenTelemetry metrics.
Feb 15, 2026 12:04:34 PM com.google.cloud.grpc.GcpManagedChannel initMetrics
INFO: pool-2: OpenTelemetry meter detected. Using OpenTelemetry metrics.
Feb 15, 2026 12:04:35 PM com.google.cloud.grpc.GcpManagedChannel initMetrics
INFO: pool-3: OpenTelemetry meter detected. Using OpenTelemetry metrics.
Feb 15, 2026 12:04:35 PM com.google.cloud.spanner.SpannerImpl logSpannerOptions
INFO: Spanner options:
Project ID: <REDACTED>
Host: https://spanner.googleapis.com
Num gRPC channels: 8
Leader aware routing enabled: true
Direct access enabled: false
Active Tracing Framework: OPEN_CENSUS
API tracing enabled: false
Extended tracing enabled: false
End to end tracing enabled: false
Built-in metrics enabled: false
Feb 15, 2026 12:04:35 PM com.google.cloud.spanner.SpannerImpl logSpannerOptions
INFO: Session pool options (deprecated, no longer used):
Session pool min sessions: 100
Session pool max sessions: 400
Multiplexed sessions enabled: true
Multiplexed sessions enabled for RW: true
Multiplexed sessions enabled for blind write: true
Multiplexed sessions enabled for partitioned ops: true
SpannerClient was created. Took 1.133 s

Approximately 5-10 seconds later:

INFO - 2026-02-15 13:07:05.746 CET - Feb 15, 2026 12:07:03 PM com.google.cloud.spanner.SpannerCloudMonitoringExporter$1 onFailure
INFO - 2026-02-15 13:07:05.746 CET - WARNING: createServiceTimeSeries request failed for spanner metrics. Need monitoring metric writer permission on project=<REDACTED>. Follow https://cloud.google.com/spanner/docs/view-manage-client-side-metrics#access-client-side-metrics to set up permissions
ERROR - 2026-02-15 13:07:05.746 CET - com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission monitoring.timeSeries.create denied (or the resource may not exist).

Environment details

  1. Spanner Java lib 6.105
  2. OS type and version: Mac OS X 26.2
  3. Java version: 25

Steps to reproduce

setBuiltInMetricsEnabled() simply has no effect.
Create the client within a project without time series permission and observe the same result

Code example

This is the only place in the code where SpannerOptions is created.

              var optionsBuilder =
                  SpannerOptions.newBuilder()
                      .setProjectId(config.getInfraProjectId())
                      .setBuiltInMetricsEnabled(false);

Stack trace

com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission monitoring.timeSeries.create denied (or the resource may not exist).
	at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:98)
	at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:41)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:86)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:66)
	at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:84)
	at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1125)
	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1004)
	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:767)
	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:516)
	at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:668)
	at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:638)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at com.google.api.gax.grpc.ChannelPool$ReleasingClientCall$1.onClose(ChannelPool.java:602)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at com.google.api.gax.grpc.GrpcLoggingInterceptor$1$1.onClose(GrpcLoggingInterceptor.java:98)
	at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:500)
	at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:464)
	at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:497)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:566)
	at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:72)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:734)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:715)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission monitoring.timeSeries.create denied (or the resource may not exist).
	at io.grpc.Status.asRuntimeException(Status.java:532)
	... 21 more

External references such as API reference guides

  • ?

Any additional information below

Following these steps guarantees the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/java-spanner API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions