Repository: GoogleCloudPlatform/pgadapter (java)

Issue:
OpenTelemetry Cardinality Errors and ResourceExhaustedException 
<!--- Provide a general summary of the issue in the Title above -->

## Current Behavior
Receiving multiple rounds of error messages below:
```
[2024-09-24 09:24:05.576] [WARNING] (io.opentelemetry.sdk.internal.ThrottlingLogger doLog): Instrument spanner/pgadapter/client_lib_latencies has exceeded the maximum allowed cardinality (1999).

[2024-09-24 09:24:05.577] [WARNING] (io.opentelemetry.sdk.internal.ThrottlingLogger doLog): Instrument spanner/pgadapter/roundtrip_latencies has exceeded the maximum allowed cardinality (1999).

[2024-09-24 09:24:17.173] [WARNING] (io.opentelemetry.sdk.metrics.export.PeriodicMetricReader$Scheduled doRun): Exporter threw an Exception

com.google.api.gax.rpc.ResourceExhaustedException: io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: One or more TimeSeries could not be written: Monitored resource has too many time series (workload metrics).: generic_node{location:global,namespace:,node_id:} timeSeries[0-199]: workload.googleapis.com/spanner/pgadapter/roundtrip_latencies{project_id:<REDACTED>,database:<REDACTED>,instrumentation_source:cloud.google.com/java,instrumentation_version:,pgadapter_connection_id:9692880b-d1d1-467e-bb27-f7bc4243f9f0,service_name:pgadapter-66900913,instance_id:<REDACTED>}
	at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:100)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:98)
	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:1130)
	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
```

- Errors seem to occur across all pods
- Cardinality errors are emitted after ~55 minutes of uptime and repeat every 12 seconds thereafter on each pod
- `RESOURCE_EXHAUSTED` exceptions start emitting after 1 minute of uptime and tend to repeat every minute thereafter on each pod
- On `RESOURCE_EXHAUSTED` exceptions within a single PGAdapter instance, `pgadapter_connection_id` tends to change over time

## Context (Environment)

- Running PGAdapter 0.39.0 as a sidecar in GKE
- 72 Pods in the Deployment
- PGAdapter configured with 1 vCPU and 2GB Memory limits (actual CPU use hovers at ~ 100mCPU)
- PGAdapter executed with the following args:
```
- args:
  - -p
  - <REDACTED>
  - -i
  - <REDACTED>
  - -d
  - <REDACTED>
  - -enable_otel
  - -otel_trace_ratio=0.05
  - -enable_otel_metrics
```

## Other Information
I poked around Metrics Explorer to see if there was anything out of the ordinary. When looking at both `workload.googleapis.com/spanner/pgadapter/roundtrip_latencies` and `workload.googleapis.com/spanner/pgadapter/client_lib_latencies` over the last 3 hours, then changing the aggregation to counting time series, it produces a value of 162,745 which seems like a lot of time series.

I inspected another distribution type metric, `spanner.googleapis.com/transaction_stat/total/transaction_latencies`, and it produced a value of 1.

I'm not sure if the difference here is a problem, but thought it was interesting enough to mention.

Pull request description:
fix: remove connection-id from metrics attributes
The OpenTelemetry Attributes for metrics included a unique identifier for each connection. This can potentially create a very large number of time series, as each connection will be a time serie. Applications that continously create and drop connections will then produce a very large number of time series, which again can result in RESOURCE_EXHAUSTED error being returned from the monitoring backend.

Fixes #2377

Patch:
diff --git a/.ci/evaluate-with-psql.sh b/.ci/evaluate-with-psql.sh
index 2d0dec1a..8aa9fe24 100644
--- a/.ci/evaluate-with-psql.sh
+++ b/.ci/evaluate-with-psql.sh
@@ -86,43 +86,43 @@ diff -i -w -s .ci/e2e-result/backslash-l.txt .ci/e2e-expected/backslash-l.txt
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"-c option dml batching\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "$(cat .ci/e2e-batching/dml-batch.txt)" > .ci/e2e-result/dml-batching.txt
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "$(cat .ci/e2e-batching/dml-batch.txt)" > .ci/e2e-result/dml-batching.txt
 diff -i -w -s .ci/e2e-result/dml-batching.txt .ci/e2e-expected/dml-batching.txt
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"-c option ddl batching\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "$(cat .ci/e2e-batching/ddl-batch.txt)"
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "$(cat .ci/e2e-batching/ddl-batch.txt)"
 echo "\d" | /usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" > .ci/e2e-result/ddl-batching.txt
 diff -i -w -s .ci/e2e-result/ddl-batching.txt .ci/e2e-expected/ddl-batching.txt
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"-c option ddl-dml mix batching\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "$(cat .ci/e2e-batching/ddl-dml-batch.txt)" &> .ci/e2e-result/ddl-dml-batching.txt
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "$(cat .ci/e2e-batching/ddl-dml-batch.txt)" &> .ci/e2e-result/ddl-dml-batching.txt
 diff -i -w -s .ci/e2e-result/ddl-dml-batching.txt .ci/e2e-expected/ddl-dml-batching.txt
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"-c option SELECT DML batching\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "$(cat .ci/e2e-batching/select-dml-batch.txt)" &> .ci/e2e-result/select-dml-batching.txt
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "$(cat .ci/e2e-batching/select-dml-batch.txt)" &> .ci/e2e-result/select-dml-batching.txt
 diff -i -w -s .ci/e2e-result/select-dml-batching.txt .ci/e2e-expected/select-dml-batching.txt
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"-c option SELECT DDL batching\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "$(cat .ci/e2e-batching/select-ddl-batch.txt)" &> .ci/e2e-result/select-ddl-batching.txt
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "$(cat .ci/e2e-batching/select-ddl-batch.txt)" &> .ci/e2e-result/select-ddl-batching.txt
 diff -i -w -s .ci/e2e-result/select-ddl-batching.txt .ci/e2e-expected/select-ddl-batching.txt
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"-c option WITH DML batching\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "$(cat .ci/e2e-batching/with-dml-batch.txt)" &> .ci/e2e-result/with-dml-batching.txt
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "$(cat .ci/e2e-batching/with-dml-batch.txt)" &> .ci/e2e-result/with-dml-batching.txt
 diff -i -w -s .ci/e2e-result/with-dml-batching.txt .ci/e2e-expected/with-dml-batching.txt
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"-c option begin/commit batching\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "$(cat .ci/e2e-batching/begin-commit-batch.txt)" &> .ci/e2e-result/begin-commit-batching.txt
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "$(cat .ci/e2e-batching/begin-commit-batch.txt)" &> .ci/e2e-result/begin-commit-batching.txt
 diff -i -w -s .ci/e2e-result/begin-commit-batching.txt .ci/e2e-expected/begin-commit-batching.txt
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"COPY FROM STDIN\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "COPY users FROM STDIN;" <<EOF
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "COPY users FROM STDIN;" <<EOF
 12	12	12
 13	13	13
 14	14	14
@@ -136,7 +136,7 @@ diff -i -w -s .ci/e2e-result/copy-from-stdin.txt .ci/e2e-expected/copy-from-stdi
 RETURN_CODE=$((${RETURN_CODE}||$?))
 
 echo "------Test \"COPY FROM STDIN in batch\"------"
-/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" -c "select 0; COPY users FROM STDIN; COPY users FROM STDIN; select 1;" <<EOF
+/usr/lib/postgresql/"${PSQL_VERSION}"/bin/psql -h localhost -p 4242 -d "${GOOGLE_CLOUD_DATABASE_WITH_VERSION}" --set=SHOW_ALL_RESULTS=off -c "select 0; COPY users FROM STDIN; COPY users FROM STDIN; select 1;" <<EOF
 18	18	18
 \.
 19	19	19
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 635eb841..ba1cd26a 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -32,7 +32,7 @@ jobs:
         distribution: 'zulu'
     - run: java -version
     - run: .ci/run-with-credentials.sh lint
-  e2e-psql-v11-v14:
+  e2e-psql-v12-v14:
     needs: [check-env]
     if: needs.check-env.outputs.has-key == 'true'
     runs-on: ubuntu-latest
@@ -43,12 +43,12 @@ jobs:
           java-version: 11
           distribution: 'zulu'
       - run: java -version
-      - name: "Install postgresql-client-11"
+      - name: "Install postgresql-client-12"
         run: |
           sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
           wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
           sudo apt-get update
-          sudo apt-get install postgresql-client-11
+          sudo apt-get install postgresql-client-12
       - id: 'auth'
         uses: google-github-actions/auth@v2
         with:
@@ -60,8 +60,8 @@ jobs:
       - name: "Install gcloud alpha component"
         run: gcloud components install alpha
       - run: .ci/run-with-credentials.sh uber-jar-build
-      - run: .ci/run-with-credentials.sh e2e-psql 11 14.1
-  e2e-psql-v12-v1-v14:
+      - run: .ci/run-with-credentials.sh e2e-psql 12 14.1
+  e2e-psql-v13-v14:
     needs: [check-env]
     if: needs.check-env.outputs.has-key == 'true'
     runs-on: ubuntu-latest
@@ -72,12 +72,12 @@ jobs:
           java-version: 11
           distribution: 'zulu'
       - run: java -version
-      - name: "Install postgresql-client-12"
+      - name: "Install postgresql-client-13"
         run: |
           sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
           wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
           sudo apt-get update
-          sudo apt-get install postgresql-client-12
+          sudo apt-get install postgresql-client-13
       - id: 'auth'
         uses: google-github-actions/auth@v2
         with:
@@ -89,8 +89,8 @@ jobs:
       - name: "Install gcloud alpha component"
         run: gcloud components install alpha
       - run: .ci/run-with-credentials.sh uber-jar-build
-      - run: .ci/run-with-credentials.sh e2e-psql 12 14.1
-  e2e-psql-v13-v14:
+      - run: .ci/run-with-credentials.sh e2e-psql 13 14.1
+  e2e-psql-v14-v14:
     needs: [check-env]
     if: needs.check-env.outputs.has-key == 'true'
     runs-on: ubuntu-latest
@@ -101,12 +101,12 @@ jobs:
           java-version: 11
           distribution: 'zulu'
       - run: java -version
-      - name: "Install postgresql-client-13"
+      - name: "Install postgresql-client-14"
         run: |
           sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
           wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
           sudo apt-get update
-          sudo apt-get install postgresql-client-13
+          sudo apt-get install postgresql-client-14
       - id: 'auth'
         uses: google-github-actions/auth@v2
         with:
@@ -118,8 +118,8 @@ jobs:
       - name: "Install gcloud alpha component"
         run: gcloud components install alpha
       - run: .ci/run-with-credentials.sh uber-jar-build
-      - run: .ci/run-with-credentials.sh e2e-psql 13 14.1
-  e2e-psql-v14-v14:
+      - run: .ci/run-with-credentials.sh e2e-psql 14 14.1
+  e2e-psql-v15-v14:
     needs: [check-env]
     if: needs.check-env.outputs.has-key == 'true'
     runs-on: ubuntu-latest
@@ -130,12 +130,12 @@ jobs:
           java-version: 11
           distribution: 'zulu'
       - run: java -version
-      - name: "Install postgresql-client-14"
+      - name: "Install postgresql-client-15"
         run: |
           sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
           wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
           sudo apt-get update
-          sudo apt-get install postgresql-client-14
+          sudo apt-get install postgresql-client-15
       - id: 'auth'
         uses: google-github-actions/auth@v2
         with:
@@ -147,4 +147,62 @@ jobs:
       - name: "Install gcloud alpha component"
         run: gcloud components install alpha
       - run: .ci/run-with-credentials.sh uber-jar-build
-      - run: .ci/run-with-credentials.sh e2e-psql 14 14.1
+      - run: .ci/run-with-credentials.sh e2e-psql 15 14.1
+  e2e-psql-v16-v14:
+    needs: [check-env]
+    if: needs.check-env.outputs.has-key == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-java@v4
+        with:
+          java-version: 11
+          distribution: 'zulu'
+      - run: java -version
+      - name: "Install postgresql-client-16"
+        run: |
+          sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+          wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+          sudo apt-get update
+          sudo apt-get install postgresql-client-16
+      - id: 'auth'
+        uses: google-github-actions/auth@v2
+        with:
+          credentials_json: '${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}'
+      - id: 'setup-gcloud'
+        uses: google-github-actions/setup-gcloud@v2
+        with:
+          project_id: ${{ env.GOOGLE_CLOUD_PROJECT }}
+      - name: "Install gcloud alpha component"
+        run: gcloud components install alpha
+      - run: .ci/run-with-credentials.sh uber-jar-build
+      - run: .ci/run-with-credentials.sh e2e-psql 16 14.1
+  e2e-psql-v17-v14:
+    needs: [check-env]
+    if: needs.check-env.outputs.has-key == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-java@v4
+        with:
+          java-version: 11
+          distribution: 'zulu'
+      - run: java -version
+      - name: "Install postgresql-client-17"
+        run: |
+          sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+          wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+          sudo apt-get update
+          sudo apt-get install postgresql-client-17
+      - id: 'auth'
+        uses: google-github-actions/auth@v2
+        with:
+          credentials_json: '${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}'
+      - id: 'setup-gcloud'
+        uses: google-github-actions/setup-gcloud@v2
+        with:
+          project_id: ${{ env.GOOGLE_CLOUD_PROJECT }}
+      - name: "Install gcloud alpha component"
+        run: gcloud components install alpha
+      - run: .ci/run-with-credentials.sh uber-jar-build
+      - run: .ci/run-with-credentials.sh e2e-psql 17 14.1
diff --git a/benchmarks/tpcc/src/main/java/com/google/cloud/pgadapter/tpcc/BenchmarkApplication.java b/benchmarks/tpcc/src/main/java/com/google/cloud/pgadapter/tpcc/BenchmarkApplication.java
index 1f2f704e..996e859f 100644
--- a/benchmarks/tpcc/src/main/java/com/google/cloud/pgadapter/tpcc/BenchmarkApplication.java
+++ b/benchmarks/tpcc/src/main/java/com/google/cloud/pgadapter/tpcc/BenchmarkApplication.java
@@ -245,7 +245,6 @@ public class BenchmarkApplication implements CommandLineRunner {
 
   static Attributes createMetricAttributes(SpannerConfiguration spannerConfiguration) {
     AttributesBuilder attributesBuilder = Attributes.builder();
-    attributesBuilder.put("connection_id", UUID.randomUUID().toString());
     attributesBuilder.put("database", spannerConfiguration.getDatabase());
     attributesBuilder.put("instance_id", spannerConfiguration.getInstance());
     attributesBuilder.put("project_id", spannerConfiguration.getProject());
diff --git a/samples/java/hibernate/pom.xml b/samples/java/hibernate/pom.xml
index 49452f8c..a3f49a17 100644
--- a/samples/java/hibernate/pom.xml
+++ b/samples/java/hibernate/pom.xml
@@ -69,7 +69,7 @@
     <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-databind</artifactId>
-      <version>2.17.2</version>
+      <version>2.18.0</version>
     </dependency>
     
     <!-- NOTE: This dependency is deliberately not defined with scope <test>, as that breaks the use of testcontainers in the sample application. -->
diff --git a/src/main/java/com/google/cloud/spanner/pgadapter/commands/ListCommand.java b/src/main/java/com/google/cloud/spanner/pgadapter/commands/ListCommand.java
index e5ac8da5..db771778 100644
--- a/src/main/java/com/google/cloud/spanner/pgadapter/commands/ListCommand.java
+++ b/src/main/java/com/google/cloud/spanner/pgadapter/commands/ListCommand.java
@@ -24,14 +24,13 @@ public class ListCommand extends Command {
 
   private static final Pattern INPUT_REGEX =
       Pattern.compile(
-          "^SELECT d\\.datname as \"Name\",\n"
-              + "       pg_catalog\\.pg_get_userbyid\\(d.datdba\\) as \"Owner\",\n"
-              + "       pg_catalog\\.pg_encoding_to_char\\(d\\.encoding\\) as \"Encoding\",\n"
-              + "(?:\\s*d\\.datcollate as \"Collate\",\n)?"
-              + "(?:\\s*d\\.datctype as \"Ctype\",\n)?"
-              + "       pg_catalog\\.array_to_string\\(d\\.datacl, .*\\) AS \"Access privileges\"\n"
-              + "FROM pg_catalog\\.pg_database d\n.*\n?"
-              + "ORDER BY 1;?$");
+          "^SELECT\\s+d\\.datname as \"Name\",\n"
+              + "\\s*pg_catalog\\.pg_get_userbyid\\(d.datdba\\) as \"Owner\",\n"
+              + ".*"
+              + "\\s*pg_catalog\\.array_to_string\\(d\\.datacl, .*\\)(:? END)? AS \"Access privileges\"\n"
+              + "FROM (?:pg_catalog\\.)?pg_database d\n.*\n?"
+              + "ORDER BY 1;?$",
+          Pattern.DOTALL);
 
   ListCommand(String sql) {
     super(sql);
diff --git a/src/main/java/com/google/cloud/spanner/pgadapter/statements/ExtendedQueryProtocolHandler.java b/src/main/java/com/google/cloud/spanner/pgadapter/statements/ExtendedQueryProtocolHandler.java
index 3c74fce1..1cef475e 100644
--- a/src/main/java/com/google/cloud/spanner/pgadapter/statements/ExtendedQueryProtocolHandler.java
+++ b/src/main/java/com/google/cloud/spanner/pgadapter/statements/ExtendedQueryProtocolHandler.java
@@ -66,9 +66,7 @@ public class ExtendedQueryProtocolHandler {
                 .getServer()
                 .getTracer(ConnectionHandler.class.getName(), getVersion()),
             connectionHandler.getServer().getMetrics(),
-            createMetricAttributes(
-                connectionHandler.getDatabaseId(),
-                connectionHandler.getTraceConnectionId().toString()),
+            createMetricAttributes(connectionHandler.getDatabaseId()),
             connectionHandler.getTraceConnectionId().toString(),
             connectionHandler::closeAllPortals,
             connectionHandler.getDatabaseId(),
@@ -97,9 +95,8 @@ public class ExtendedQueryProtocolHandler {
   }
 
   @VisibleForTesting
-  static Attributes createMetricAttributes(DatabaseId databaseId, String connectionId) {
+  static Attributes createMetricAttributes(DatabaseId databaseId) {
     AttributesBuilder attributesBuilder = Attributes.builder();
-    attributesBuilder.put("pgadapter.connection_id", connectionId);
     attributesBuilder.put("database", databaseId.getDatabase());
     attributesBuilder.put("instance_id", databaseId.getInstanceId().getInstance());
     attributesBuilder.put("project_id", databaseId.getInstanceId().getProject());
diff --git a/src/main/resources/metadata/default_command_metadata.json b/src/main/resources/metadata/default_command_metadata.json
index 7e711d23..647b591e 100644
--- a/src/main/resources/metadata/default_command_metadata.json
+++ b/src/main/resources/metadata/default_command_metadata.json
@@ -123,7 +123,7 @@
       "blurb": "This command is equivalent to the PSQL \\d <param> meta-command. This command is split up among multiple parts, this being the seventh. The Spanner fetch does not require a similar step so we just hardcode it."
     },
     {
-      "input_pattern": "(?s)^SELECT pubname\\s+FROM pg_catalog\\.pg_publication p\\s+JOIN pg_catalog\\.pg_publication_rel pr ON p.oid = pr\\.prpubid\\s+WHERE pr\\.prrelid = '.*'\\s+UNION ALL\\s+SELECT pubname\\s+FROM pg_catalog\\.pg_publication p\\s+WHERE p\\.puballtables AND pg_catalog\\.pg_relation_is_publishable\\('.*'\\)\\s+ORDER BY 1;?$",
+      "input_pattern": "(?s)^SELECT pubname.*\\s+FROM pg_catalog\\.pg_publication p\\s+JOIN pg_catalog\\.pg_publication_rel pr ON p.oid = pr\\.prpubid\\s+WHERE pr\\.prrelid = '.*'\\s+UNION ALL\\s+SELECT pubname.*\\s+FROM pg_catalog\\.pg_publication p\\s+WHERE p\\.puballtables AND pg_catalog\\.pg_relation_is_publishable\\('.*'\\)\\s+ORDER BY 1;?$",
       "output_pattern": "SELECT 1 LIMIT 0;",
       "matcher_array": [],
       "blurb": "This command is equivalent to the PSQL \\d <param> meta-command. This command is split up among multiple parts, this being the eighth. The Spanner fetch does not require a similar step so we just hardcode it."


Test patch:
diff --git a/src/test/java/com/google/cloud/spanner/pgadapter/statements/BackendConnectionTest.java b/src/test/java/com/google/cloud/spanner/pgadapter/statements/BackendConnectionTest.java
index 58a06cd4..7edfa78a 100644
--- a/src/test/java/com/google/cloud/spanner/pgadapter/statements/BackendConnectionTest.java
+++ b/src/test/java/com/google/cloud/spanner/pgadapter/statements/BackendConnectionTest.java
@@ -87,7 +87,7 @@ public class BackendConnectionTest {
   private static final Runnable DO_NOTHING = () -> {};
   private static final DatabaseId DATABASE_ID = DatabaseId.of("p", "i", "d");
   private static final Attributes METRIC_ATTRIBUTES =
-      ExtendedQueryProtocolHandler.createMetricAttributes(DATABASE_ID, "test-id");
+      ExtendedQueryProtocolHandler.createMetricAttributes(DATABASE_ID);
 
   @Test
   public void testExtractDdlUpdateCounts() {
diff --git a/src/test/java/com/google/cloud/spanner/pgadapter/statements/StatementTest.java b/src/test/java/com/google/cloud/spanner/pgadapter/statements/StatementTest.java
index 9cac0270..a5513ef5 100644
--- a/src/test/java/com/google/cloud/spanner/pgadapter/statements/StatementTest.java
+++ b/src/test/java/com/google/cloud/spanner/pgadapter/statements/StatementTest.java
@@ -97,7 +97,7 @@ public class StatementTest {
   private static final Runnable DO_NOTHING = () -> {};
   private static final DatabaseId DATABASE_ID = DatabaseId.of("p", "i", "d");
   private static final Attributes METRIC_ATTRIBUTES =
-      ExtendedQueryProtocolHandler.createMetricAttributes(DATABASE_ID, "test-connection");
+      ExtendedQueryProtocolHandler.createMetricAttributes(DATABASE_ID);
 
   private static ParsedStatement parse(String sql) {
     return PARSER.parse(Statement.of(sql));
@@ -521,7 +521,7 @@ public class StatementTest {
         new BackendConnection(
             NOOP_OTEL,
             NOOP_OTEL_METER,
-            ExtendedQueryProtocolHandler.createMetricAttributes(databaseId, "test-connection"),
+            ExtendedQueryProtocolHandler.createMetricAttributes(databaseId),
             UUID.randomUUID().toString(),
             DO_NOTHING,
             databaseId,
@@ -629,7 +629,7 @@ public class StatementTest {
         new BackendConnection(
             NOOP_OTEL,
             NOOP_OTEL_METER,
-            ExtendedQueryProtocolHandler.createMetricAttributes(databaseId, "test-connection"),
+            ExtendedQueryProtocolHandler.createMetricAttributes(databaseId),
             UUID.randomUUID().toString(),
             DO_NOTHING,
             databaseId,
@@ -688,7 +688,7 @@ public class StatementTest {
         new BackendConnection(
             NOOP_OTEL,
             NOOP_OTEL_METER,
-            ExtendedQueryProtocolHandler.createMetricAttributes(databaseId, "test-connection"),
+            ExtendedQueryProtocolHandler.createMetricAttributes(databaseId),
             UUID.randomUUID().toString(),
             DO_NOTHING,
             databaseId,