cloud-sql-proxy icon indicating copy to clipboard operation
cloud-sql-proxy copied to clipboard

Intermittent errors logged after enabling telemetry

Open tomassommareqt opened this issue 3 years ago • 10 comments

Bug Description

We are running gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.7.0 as a container next to our main http api container for connectivity to our CloudSQL instance.

After enabling telemetry using the --telemetry-project and -telemetry-prefix flags we have recurrently gotten the following error logged:

2023/11/04 13:58:43 Failed to export to Stackdriver: rpc error: code = Internal desc = One or more TimeSeries could not be written: Internal error encountered. Please retry after a few seconds. If internal errors persist, contact support at https://cloud.google.com/support/docs.: global{} timeSeries[0]: custom.googleapis.com/opencensus/<redacted>_cloud_sql_proxy/cloudsqlconn/refresh_success_count{opencensus_task:go-1@<redacted>,cloudsql_instance:<redacted>}; Internal error encountered. Please retry after a few seconds. If internal errors persist, contact support at https://cloud.google.com/support/docs.: global{} timeSeries[1]: custom.googleapis.com/opencensus/<redacted>_cloud_sql_proxy/cloudsqlconn/dial_latency{cloudsql_instance:<redacted>,opencensus_task:go-1@<redacted>}

However when expecting the metrics we can see that it works as expected. So this is mostly causes the issue of polluted logs. But it would also be interesting to understand why this error is reported.

Example code (or command)

// paste your code or command here

Stacktrace

`2023/11/04 13:58:43 Failed to export to Stackdriver: rpc error: code = Internal desc = One or more TimeSeries could not be written: Internal error encountered. Please retry after a few seconds. If internal errors persist, contact support at https://cloud.google.com/support/docs.: global{} timeSeries[0]: custom.googleapis.com/opencensus/<redacted>_cloud_sql_proxy/cloudsqlconn/refresh_success_count{opencensus_task:go-1@<redacted>,cloudsql_instance:<redacted>}; Internal error encountered. Please retry after a few seconds. If internal errors persist, contact support at https://cloud.google.com/support/docs.: global{} timeSeries[1]: custom.googleapis.com/opencensus/<redacted>_cloud_sql_proxy/cloudsqlconn/dial_latency{cloudsql_instance:<redacted>,opencensus_task:go-1@<redacted>}`

Steps to reproduce?

  1. Launch cloud-sql-proxy 2.7.0 as a container in GCP GKE.
  2. Inspect logs.

Environment

  1. OS type and version: GCP GKE 1.24.14-gke.2700
  2. Cloud SQL Proxy version: 2.7.0
  3. Proxy invocation command: apiVersion: apps/v1 kind: Deployment metadata: name: <redacted> spec: template: spec: containers: - name: cloudsql-proxy image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.7.0 args: - "--auto-iam-authn" - "--max-sigterm-delay" - "25s" - "--structured-logs" - "--telemetry-project" - "<redacted>" - "--telemetry-prefix" - "<redacted>_cloud_sql_proxy" - "<connection-string-redacted>"

Additional Details

No response

tomassommareqt avatar Nov 06 '23 10:11 tomassommareqt

Thanks @tomassommareqt. FWIW I have seen the same logs when working on this feature. I don't expect these logs to show up outside of a dev context, though. We'll investigate and fix this.

enocom avatar Nov 06 '23 16:11 enocom

still seen in 2.9.0 although the metrics work using metrics writer role

2024/03/15 23:10:50 Failed to export to Stackdriver: rpc error: code = PermissionDenied desc = The caller does not have permission

rojomisin avatar Mar 15 '24 22:03 rojomisin

Thanks, @rojomisin. We still haven't got to this. I wonder if this is race condition in OpenCensus itself.

enocom avatar Mar 22 '24 17:03 enocom

perhaps fixed in OpenTelemetry pkg? https://github.com/open-telemetry/opentelemetry-go-contrib

rojomisin avatar Mar 22 '24 20:03 rojomisin

Quite possibly. We're currently using OpenCensus given that some internal tooling that uses the Proxy has a big investment in OpenCensus. But we might revisit that decision now that OpenTelemetry's metrics package is stable.

enocom avatar Apr 01 '24 15:04 enocom

We will be migrating OpenTelemetry in the somewhat near future which will hopefully resolve this issue...

jackwotherspoon avatar Oct 29 '24 13:10 jackwotherspoon

We are now actively working on the Open Telemetry migration. Please stay tuned. We will update this ticket when we have an estimated completion date.

hessjcg avatar Nov 05 '25 20:11 hessjcg

I'm seeing this log line come up just once shortly after startup, in a Google Cloud VM:

2026/02/17 16:13:37 Failed to export to Stackdriver: rpc error: code = Internal desc = Internal error encountered. Please retry after a few seconds. If internal errors persist, contact support at https://cloud.google.com/support/docs.

We have a systemd service set up around the CSP binary.

This is the version I'm running:

# cloud-sql-proxy --version
cloud-sql-proxy version 2.21.0+linux.amd64

The only flag passed to the CSP binary is --config-file which points to a YAML containing this:

---
address: '0.0.0.0'
port: 5432
private-ip: true
exit-zero-on-sigterm: true
telemetry-prefix: my-prefix
disable-traces: true
impersonate-service-account: [email protected]
instance-connection-name: my-project:europe-west1:my-csql-instance
telemetry-project: my-project

jlucktay avatar Feb 17 '26 16:02 jlucktay

@jlucktay Hi, thank you for reporting this issue.

I don't think we have make any stackdriver changes recently. I wonder if this log line only come up recently?

Just to make sure - Is that causing an issue to the application?

panavenue avatar Feb 24 '26 16:02 panavenue

Hi @panavenue, we've only just recently rolled out CSP like this so I don't know if (1) the log line is new, or (2) I'm just new to seeing it in this setup. I don't think it's causing any issues, but it's related to observability, so if logs or metrics were going missing and weren't making it out of the instances, then I don't think I would know anyway without going into one of the instances and eyeballing things side-by-side.

jlucktay avatar Feb 25 '26 10:02 jlucktay