googleapis / googleapis/google-cloud-go
spanner: Native Metrics Enabled by Default in v1.71.0+ Causes Permission Errors
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
**Description**
After upgrading to Spanner client library versions >v1.71.0, our application began failing with permission errors (monitoring.timeSeries.create denied) in production. This is caused by the new native metrics collection being enabled by default, which requires the monitoring.metricWriter role. While disabling via DisableNativeMetrics: true resolves the issue, we believe this behavior introduces an unexpected breaking change and poses risks for existing users.
```
// Current behavior (v1.71.0+) causes errors unless explicitly disabled
client, err := spanner.NewClientWithConfig(ctx, database, spanner.ClientConfig{
DisableNativeMetrics: true, // Required to avoid permission issues
})
```
**Proposed Fixes**
Change Default to DisableNativeMetrics: true:
Revert to disabling metrics by default to avoid breaking existing deployments.
**Environment**
Library Version: v1.71.0+
GCP Environment: Cloud Run / GKE / etc.
Permissions: Service account lacks monitoring.metricWriter.
Contributor guide
Assessment
This issue has not been assessed yet.